Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

SuperTrend - Custom Screener and Dynamic Alerts

A Pine Script v4 strategy built on Supertrend (3, 10). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 2 settings; defaults include Mult 3 and Period 10.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does SuperTrend - Custom Screener and Dynamic Alerts repaint?
Yes
At least one pattern in the source can repaint: higher-timeframe data.
How did SuperTrend - Custom Screener and Dynamic Alerts do on BTCUSDT 1D with default settings?
−9.72%
From 26 Jan 2024 to 21 Oct 2026, over 27 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can SuperTrend - Custom Screener and Dynamic Alerts be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
What alerts does SuperTrend - Custom Screener and Dynamic Alerts have?
2
array.get(alert_strings, 0); array.get(alert_strings, 1).
Does SuperTrend - Custom Screener and Dynamic Alerts use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$108,873$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market. The live re-run is not offered here: the script requests DJI D, IXIC D, SPX D, RUT D, AAPL D, AMZN D, FB D, GOOG D, NFLX D, MSFT D, NVDA D, FDX D, GLD D, which this page cannot load in your browser.

Needs DJI D data, not available: not a Binance spot market Needs IXIC D data, not available: not a Binance spot market Needs SPX D data, not available: not a Binance spot market Needs RUT D data, not available: not a Binance spot market Needs AAPL D data, not available: not a Binance spot market Needs AMZN D data, not available: not a Binance spot market Needs FB D data, not available: not a Binance spot market Needs GOOG D data, not available: not a Binance spot market Needs NFLX D data, not available: not a Binance spot market Needs MSFT D data, not available: not a Binance spot market Needs NVDA D data, not available: not a Binance spot market Needs FDX D data, not available: not a Binance spot market Needs GLD D data, not available: not a Binance spot market Values that depend on it are empty on this chart.

Table drawn by the script, as it stood on the last bar
SuperTrend Sell ▼▼
TickerCloseDHighDLow% Change
Net profit
−9.72%
−$9,717.39
Buy and hold
+102.5%
same period
Closed trades
27
9 won · 18 lost
Profitable
33.3%
of closed trades
Profit factor
0.92
gross profit ÷ gross loss
Max drawdown
51.91%
−$59,410.20

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    2 settings have no label

    In the settings dialog mult (line 30), period (line 31) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames supertrend → ta.supertrend, security → request.security, tostring → str.tostring, round → math.round, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

Verified

Same 27 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 30: input(type = input.float) → input.float()
  • Line 31: input(type = input.integer) → input.int()
  • Line 32: supertrend → ta.supertrend
  • Line 46: security → request.security
  • Line 48: security → request.security
30 more edits
  • Line 49: tostring → str.tostring
  • Line 49: round → math.round
  • Line 49: tostring → str.tostring
  • Line 49: round → math.round
  • Line 53: crossover → ta.crossover
  • Line 54: tostring → str.tostring
  • Line 54: round → math.round
  • Line 54: tostring → str.tostring
  • Line 54: round → math.round
  • Line 61: tostring → str.tostring
  • Line 61: round → math.round
  • Line 62: tostring → str.tostring
  • Line 62: round → math.round
  • Line 63: tostring → str.tostring
  • Line 63: round → math.round
  • Line 64: tostring → str.tostring
  • Line 64: round → math.round
  • Line 66: crossunder → ta.crossunder
  • Line 67: tostring → str.tostring
  • Line 67: round → math.round
  • Line 67: tostring → str.tostring
  • Line 67: round → math.round
  • Line 73: tostring → str.tostring
  • Line 73: round → math.round
  • Line 74: tostring → str.tostring
  • Line 74: round → math.round
  • Line 75: tostring → str.tostring
  • Line 75: round → math.round
  • Line 76: tostring → str.tostring
  • Line 76: round → math.round
⋯// © ralagh-//@version=4+//@version=5strategy("Supertrend", overlay = true, format=format.price, precision=2)⋯table.cell(table_id = DnTabl, column = 4, row = 1, text = "% Change")-mult = input(type=input.float, defval=3)+mult = input.float(defval=3)-period = input(type=input.integer, defval=10)+period = input.int(defval=10)-[superTrend, dir] = supertrend(mult, period)+[superTrend, dir] = ta.supertrend(mult, period)colResistance = dir == 1 and dir == dir[1] ? color.new(color.red, 0) : color.new(color.red, 100)⋯    -    [cl_dp, hi_dp, lo_dp, chg_dp] = security(_ticker, 'D', [close, high, low, p_chg], lookahead = barmerge.lookahead_on)+    [cl_dp, hi_dp, lo_dp, chg_dp] = request.security(_ticker, 'D', [close, high, low, p_chg], lookahead = barmerge.lookahead_on)    -    [cl_p, ST_R] = security(_ticker, timeframe.period, [close, superTrend], lookahead = barmerge.lookahead_on)+    [cl_p, ST_R] = request.security(_ticker, timeframe.period, [close, superTrend], lookahead = barmerge.lookahead_on)-    _msg = _ticker + "~Cls-" + tostring(round(cl_p * 100) / 100) + "/" + tostring(round(chg_dp * 100) / 100) + "% ,"+    _msg = _ticker + "~Cls-" + str.tostring(math.round(cl_p * 100) / 100) + "/" + str.tostring(math.round(chg_dp * 100) / 100) + "% ,"    ⋯//cl_p < ST_R  (Downtrend)-    if crossover(cl_p, ST_R)   +    if ta.crossover(cl_p, ST_R)   -        _msg := _msg + "PHi~" + tostring(round(hi_dp * 100) / 100) + ", PLo~" + tostring(round(lo_dp * 100) / 100) + "-ST▲"+        _msg := _msg + "PHi~" + str.tostring(math.round(hi_dp * 100) / 100) + ", PLo~" + str.tostring(math.round(lo_dp * 100) / 100) + "-ST▲"        array.set(alert_strings, 0, array.get(alert_strings, 0) + "\n" + _msg)⋯            table.cell(table_id = UpTabl, column = 0, row = array.get(table_row_count, 0), text = _ticker)-            table.cell(table_id = UpTabl, column = 1, row = array.get(table_row_count, 0), text = tostring(round(cl_p * 100) / 100), bgcolor=color.rgb(0, 200, 100))+            table.cell(table_id = UpTabl, column = 1, row = array.get(table_row_count, 0), text = str.tostring(math.round(cl_p * 100) / 100), bgcolor=color.rgb(0, 200, 100))-            table.cell(table_id = UpTabl, column = 2, row = array.get(table_row_count, 0), text = tostring(round(hi_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))+            table.cell(table_id = UpTabl, column = 2, row = array.get(table_row_count, 0), text = str.tostring(math.round(hi_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))-            table.cell(table_id = UpTabl, column = 3, row = array.get(table_row_count, 0), text = tostring(round(lo_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))+            table.cell(table_id = UpTabl, column = 3, row = array.get(table_row_count, 0), text = str.tostring(math.round(lo_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))-            table.cell(table_id = UpTabl, column = 4, row = array.get(table_row_count, 0), text = tostring(round(chg_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))+            table.cell(table_id = UpTabl, column = 4, row = array.get(table_row_count, 0), text = str.tostring(math.round(chg_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))            -    else if crossunder(cl_p, ST_R)+    else if ta.crossunder(cl_p, ST_R)-        _msg := _msg + "PHi~" + tostring(round(hi_dp * 100) / 100) + ", PLo~" + tostring(round(lo_dp * 100) / 100) + "-ST▼"+        _msg := _msg + "PHi~" + str.tostring(math.round(hi_dp * 100) / 100) + ", PLo~" + str.tostring(math.round(lo_dp * 100) / 100) + "-ST▼"        array.set(table_row_count, 1, array.get(table_row_count, 1) + 1)⋯            table.cell(table_id = DnTabl, column = 0, row = array.get(table_row_count, 1), text = _ticker)-            table.cell(table_id = DnTabl, column = 1, row = array.get(table_row_count, 1), text = tostring(round(cl_p * 100) / 100), bgcolor=color.rgb(255, 0, 0))+            table.cell(table_id = DnTabl, column = 1, row = array.get(table_row_count, 1), text = str.tostring(math.round(cl_p * 100) / 100), bgcolor=color.rgb(255, 0, 0))-            table.cell(table_id = DnTabl, column = 2, row = array.get(table_row_count, 1), text = tostring(round(hi_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))+            table.cell(table_id = DnTabl, column = 2, row = array.get(table_row_count, 1), text = str.tostring(math.round(hi_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))-            table.cell(table_id = DnTabl, column = 3, row = array.get(table_row_count, 1), text = tostring(round(lo_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))+            table.cell(table_id = DnTabl, column = 3, row = array.get(table_row_count, 1), text = str.tostring(math.round(lo_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))-            table.cell(table_id = DnTabl, column = 4, row = array.get(table_row_count, 1), text = tostring(round(chg_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))+            table.cell(table_id = DnTabl, column = 4, row = array.get(table_row_count, 1), text = str.tostring(math.round(chg_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))            ⋯

Clean v5

VerifiedDownload the v5 script

Same 27 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 80: input() → input.string()
  • Line 81: input() → input.string()
  • Line 82: input() → input.string()
  • Line 83: input() → input.string()
  • Line 84: input() → input.string()
  • Line 85: input() → input.string()
7 more edits
  • Line 86: input() → input.string()
  • Line 87: input() → input.string()
  • Line 88: input() → input.string()
  • Line 89: input() → input.string()
  • Line 90: input() → input.string()
  • Line 91: input() → input.string()
  • Line 92: input() → input.string()
⋯f_SupCro(syminfo.tickerid)-f_SupCro(input('DJI', title=input.symbol)) +f_SupCro(input.string('DJI', title=input.symbol)) -f_SupCro(input('IXIC', title=input.symbol)) +f_SupCro(input.string('IXIC', title=input.symbol)) -f_SupCro(input('SPX', title=input.symbol)) +f_SupCro(input.string('SPX', title=input.symbol)) -f_SupCro(input('RUT', title=input.symbol)) +f_SupCro(input.string('RUT', title=input.symbol)) -f_SupCro(input('AAPL', title=input.symbol))+f_SupCro(input.string('AAPL', title=input.symbol))-f_SupCro(input('AMZN', title=input.symbol)) +f_SupCro(input.string('AMZN', title=input.symbol)) -f_SupCro(input('FB', title=input.symbol)) +f_SupCro(input.string('FB', title=input.symbol)) -f_SupCro(input('GOOG', title=input.symbol)) +f_SupCro(input.string('GOOG', title=input.symbol)) -f_SupCro(input('NFLX', title=input.symbol))+f_SupCro(input.string('NFLX', title=input.symbol))-f_SupCro(input('MSFT', title=input.symbol)) +f_SupCro(input.string('MSFT', title=input.symbol)) -f_SupCro(input('NVDA', title=input.symbol)) +f_SupCro(input.string('NVDA', title=input.symbol)) -f_SupCro(input('FDX', title=input.symbol)) +f_SupCro(input.string('FDX', title=input.symbol)) -f_SupCro(input('GLD', title=input.symbol))+f_SupCro(input.string('GLD', title=input.symbol))if array.get(alert_strings, 0) != ""⋯

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 27 before, 167 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © ralagh-//@version=5+//@version=6strategy("Supertrend", overlay = true, format=format.price, precision=2)⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Mult (no label in the script)3floatsuperTrend dir
Period (no label in the script)10int (written input.integer)superTrend dir

What it calculates

  • Supertrend (supertrend, ta.supertrend in v5)Mult (3), Period (10)superTrend · line 32
  • Supertrend (supertrend, ta.supertrend in v5)Mult (3), Period (10)dir · line 32

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

high · low · closehigh · low · closeprice datamultMultsetting · 3periodPeriodsetting · 10closecloseprice datalowlowprice datahighhighprice datasuperTrendSupertrend→ superTrenddirSupertrend→ dirp_chgp_chgvaluecl_dp, hi_dp, lo_dp, chg_dpcl_dp · hi_dp +24 valuescl_p, ST_Rcl_p · ST_R2 values_msg_msgvalueUpTabl, DnTabl, colResistance, colSupportColourUpTabl · DnTabl +2entry:BuyOpen Buystrategy.entryentry:SellOpen Sellstrategy.entryplot:35plotplotplot:36plotplotalert:94alertalertalert:96alertalert

Order rules

OrderFires whenBy defaultLine
Open Buy long(dir == -1 and dir == dir[1])On38
Open Sell short(dir == 1 and dir == dir[1])On40

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
(no title)alertarray.get(alert_strings, 0)94
(no title)alertarray.get(alert_strings, 1)96

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

6/6trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • CheckHigher-timeframe data2 security call(s) use lookahead_on (line 46, 48). Without a [1] offset this reads future bars in history.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

Not run on other markets: the script requests DJI D, IXIC D, SPX D, RUT D, AAPL D, AMZN D, FB D, GOOG D, NFLX D, MSFT D, NVDA D, FDX D, GLD D, and that data is not available here (not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market). Its results would rest on empty values.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market838%−$8,985.80
Sideways market1331%$9,508.22
Falling market633%−$10,239.80

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

63.5%

The 95th percentile of the worst drawdown when the same 27 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 35.4% to 63.5%; the tick is what actually happened, 44.4%. Order luck alone moves it this much.

0%73%
All 27 trades
SideEntryExitBarsP&L
short28 Jan 2024 42,120.6011 Feb 2024 47,751.1014−$5,630.45
long11 Feb 2024 47,751.1021 Mar 2024 67,840.5039$20,089.40
short21 Mar 2024 67,840.5022 May 2024 70,148.3062−$2,307.83
long22 May 2024 70,148.3023 Jun 2024 64,262.0032−$5,886.33
short23 Jun 2024 64,262.0017 Jul 2024 65,044.0024−$781.99
long17 Jul 2024 65,044.005 Aug 2024 58,161.0019−$6,883.00
short5 Aug 2024 58,161.0025 Aug 2024 64,157.0020−$5,996.02
long25 Aug 2024 64,157.007 Sep 2024 53,963.0013−$10,194.00
short7 Sep 2024 53,963.0021 Sep 2024 63,201.1014−$9,238.08
long21 Sep 2024 63,201.1025 Dec 2024 98,663.6095$35,462.50
short25 Dec 2024 98,663.6019 Jan 2025 104,556.0025−$5,892.65
long19 Jan 2025 104,556.0026 Feb 2025 88,680.4038−$15,875.80
short26 Feb 2025 88,680.404 Mar 2025 86,221.206$2,459.23
long4 Mar 2025 86,221.2012 Mar 2025 82,933.008−$3,288.17
short12 Mar 2025 82,933.0024 Apr 2025 93,691.1043−$10,758.10
long24 Apr 2025 93,691.1024 Jun 2025 105,334.0061$11,642.90
short24 Jun 2025 105,334.0011 Jul 2025 116,010.0017−$10,676.10
long11 Jul 2025 116,010.0023 Aug 2025 116,936.0043$925.99
short23 Aug 2025 116,936.003 Oct 2025 120,529.0041−$3,593.35
long3 Oct 2025 120,529.0012 Oct 2025 110,644.009−$9,884.95
short12 Oct 2025 110,644.0015 Jan 2026 96,951.8095$13,692.60
long15 Jan 2026 96,951.8022 Jan 2026 89,454.707−$7,497.05
short22 Jan 2026 89,454.706 Mar 2026 70,891.0043$18,563.70
long6 Mar 2026 70,891.0031 Mar 2026 66,797.4025−$4,093.64
short31 Mar 2026 66,797.4015 Apr 2026 74,131.6015−$7,334.17
long15 Apr 2026 74,131.6024 May 2026 76,752.0039$2,620.45
short24 May 2026 76,752.0023 Jul 2026 66,114.5060$10,637.50

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
SuperTrend - Custom Screener and Dynamic Alerts this page—v4 strategy−9.7%2751.9%
Supertrend Strategy by Zeal Terminalsupertrendv5 strategy−4.0%269.2%
Supertrend - Long & Short -Sachin Ughade by hello_sachinsupertrendv4 strategy+185.8%57163.4%
Multi Supertrend with no-repaint HTF option strategy by ramki_simplesupertrendv4 strategy−18.4%3667.6%
Supertrend - Intraday by Pritesh-StocksDevelopersupertrendv5 strategyNo trades on this market
Supertrend by Zeal Terminalsupertrendv5 indicatorindicator

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 55 msWith a workaround 1,000 bars in 218 msNot measured
PineTSNo v5 and v6 only—Not measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

The engine and this page's reading of the source count a different number of settings, so one of them has missed one.

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report. PineTS runs Pine Script v5 and v6 only.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © ralagh//@version=4strategy("Supertrend", overlay = true, format=format.price, precision=2)alert_strings = array.new_string(2)array.set(alert_strings, 0, "")array.set(alert_strings, 1, "")table_row_count = array.new_int(5)array.set(table_row_count, 0, 1)array.set(table_row_count, 1, 1)array.set(table_row_count, 2, 1)array.set(table_row_count, 3, 1)array.set(table_row_count, 4, 1)var UpTabl = table.new(position = position.top_center, columns = 5, rows = 20, bgcolor = color.rgb(255,255,255), border_width = 2, frame_color= color.black, frame_width = 2)var DnTabl = table.new(position = position.bottom_center, columns = 5, rows = 20, bgcolor = color.rgb(255,255,255), border_width = 2, frame_color= color.black, frame_width = 2)table.cell(table_id = UpTabl, column = 1, row = 0, text = "     SuperTrend Buy")table.cell(table_id = DnTabl, column = 1, row = 0, text = "     SuperTrend Sell") table.cell(table_id = UpTabl, column = 2, row = 0, text = "     ▲▲")table.cell(table_id = DnTabl, column = 2, row = 0, text = "     ▼▼") table.cell(table_id = UpTabl, column = 0, row = 1, text = "Ticker")table.cell(table_id = UpTabl, column = 1, row = 1, text = "Close")table.cell(table_id = UpTabl, column = 2, row = 1, text = "DHigh") table.cell(table_id = UpTabl, column = 3, row = 1, text = "DLow") table.cell(table_id = UpTabl, column = 4, row = 1, text = "% Change") table.cell(table_id = DnTabl, column = 0, row = 1, text = "Ticker")table.cell(table_id = DnTabl, column = 1, row = 1, text = "Close") table.cell(table_id = DnTabl, column = 2, row = 1, text = "DHigh") table.cell(table_id = DnTabl, column = 3, row = 1, text = "DLow") table.cell(table_id = DnTabl, column = 4, row = 1, text = "% Change")mult = input(type=input.float, defval=3)period = input(type=input.integer, defval=10)[superTrend, dir] = supertrend(mult, period)colResistance = dir == 1 and dir == dir[1] ? color.new(color.red, 0) : color.new(color.red, 100)colSupport = dir == -1 and dir == dir[1] ? color.new(color.green, 0) : color.new(color.green, 100)plot(superTrend, color = colResistance, linewidth=2)plot(superTrend, color = colSupport, linewidth=2)if (dir == -1 and dir == dir[1])    strategy.entry("Buy", strategy.long, comment="Buy")if (dir == 1 and dir == dir[1])    strategy.entry("Sell", strategy.short, comment="Sell")f_SupCro(_ticker)=>            p_chg = (close - close[1])/close[1] * 100        [cl_dp, hi_dp, lo_dp, chg_dp] = security(_ticker, 'D', [close, high, low, p_chg], lookahead = barmerge.lookahead_on)        [cl_p, ST_R] = security(_ticker, timeframe.period, [close, superTrend], lookahead = barmerge.lookahead_on)    _msg = _ticker + "~Cls-" + tostring(round(cl_p * 100) / 100) + "/" + tostring(round(chg_dp * 100) / 100) + "% ,"    //cl_p > ST_R  (Uptrend)//cl_p < ST_R  (Downtrend)    if crossover(cl_p, ST_R)           _msg := _msg + "PHi~" + tostring(round(hi_dp * 100) / 100) + ", PLo~" + tostring(round(lo_dp * 100) / 100) + "-ST▲"        array.set(alert_strings, 0, array.get(alert_strings, 0) + "\n" + _msg)        array.set(table_row_count, 0, array.get(table_row_count, 0) + 1)        //alert(_msg + "-Sup▲", alert.freq_once_per_bar_close ) // For Individual Stock Alerts                if barstate.islast            table.cell(table_id = UpTabl, column = 0, row = array.get(table_row_count, 0), text = _ticker)            table.cell(table_id = UpTabl, column = 1, row = array.get(table_row_count, 0), text = tostring(round(cl_p * 100) / 100), bgcolor=color.rgb(0, 200, 100))            table.cell(table_id = UpTabl, column = 2, row = array.get(table_row_count, 0), text = tostring(round(hi_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))            table.cell(table_id = UpTabl, column = 3, row = array.get(table_row_count, 0), text = tostring(round(lo_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))            table.cell(table_id = UpTabl, column = 4, row = array.get(table_row_count, 0), text = tostring(round(chg_dp * 100) / 100), bgcolor=color.rgb(0, 200, 100))                else if crossunder(cl_p, ST_R)        _msg := _msg + "PHi~" + tostring(round(hi_dp * 100) / 100) + ", PLo~" + tostring(round(lo_dp * 100) / 100) + "-ST▼"        array.set(table_row_count, 1, array.get(table_row_count, 1) + 1)        array.set(alert_strings, 1, array.get(alert_strings, 1) + "\n" + _msg)        //alert(_msg + "-Sup▼", alert.freq_once_per_bar_close) // For Individual Stock Alerts        if barstate.islast            table.cell(table_id = DnTabl, column = 0, row = array.get(table_row_count, 1), text = _ticker)            table.cell(table_id = DnTabl, column = 1, row = array.get(table_row_count, 1), text = tostring(round(cl_p * 100) / 100), bgcolor=color.rgb(255, 0, 0))            table.cell(table_id = DnTabl, column = 2, row = array.get(table_row_count, 1), text = tostring(round(hi_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))            table.cell(table_id = DnTabl, column = 3, row = array.get(table_row_count, 1), text = tostring(round(lo_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))            table.cell(table_id = DnTabl, column = 4, row = array.get(table_row_count, 1), text = tostring(round(chg_dp * 100) / 100), bgcolor=color.rgb(255, 0, 0))            //plot(close, "Close", color=#8E1599)f_SupCro(syminfo.tickerid)f_SupCro(input('DJI', title=input.symbol)) f_SupCro(input('IXIC', title=input.symbol)) f_SupCro(input('SPX', title=input.symbol)) f_SupCro(input('RUT', title=input.symbol)) f_SupCro(input('AAPL', title=input.symbol))f_SupCro(input('AMZN', title=input.symbol)) f_SupCro(input('FB', title=input.symbol)) f_SupCro(input('GOOG', title=input.symbol)) f_SupCro(input('NFLX', title=input.symbol))f_SupCro(input('MSFT', title=input.symbol)) f_SupCro(input('NVDA', title=input.symbol)) f_SupCro(input('FDX', title=input.symbol)) f_SupCro(input('GLD', title=input.symbol))if array.get(alert_strings, 0) != ""    alert(array.get(alert_strings, 0),  alert.freq_once_per_bar_close)if array.get(alert_strings, 1) != ""    alert(array.get(alert_strings, 1),  alert.freq_once_per_bar_close)