Pine Script v5 · Strategy
AC- MY SCRIPT1
A Pine Script v5 strategy built on Linreg (close, 4), SMA or EMA or WMA (close, 4) and Crossover (MAvg, OTT[2]). 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. 61 settings; defaults include Source close, OTT Period 4 and OTT Percent 4.2.
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 AC- MY SCRIPT1 repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 8 of 8 trades.
- How did AC- MY SCRIPT1 do on BTCUSDT 1D with default settings?
- −0.48%
- From 26 Jan 2024 to 21 Oct 2026, over 38 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- What alerts does AC- MY SCRIPT1 have?
- 9
- Color ALARM; GREEN ALERT; RED ALERT; Cross Alert; and more.
- Does AC- MY SCRIPT1 run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L87:C62: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
- Does AC- MY SCRIPT1 use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
BTCUSDT · 1D · default settings
- Support Line
- OTT
- Buy
- Sell
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs NIFTY D data, not available: NIFTY is not on Binance Needs S68 D data, not available: not a Binance spot market Needs 1000SHIBUSDTPERP D data, not available: 1000SHIBUSDTPERP is not on Binance Needs 1INCHUSDTPERP D data, not available: 1INCHUSDTPERP is not on Binance Needs ALGOUSDTPERP D data, not available: ALGOUSDTPERP is not on Binance Needs ALICEUSDTPERP D data, not available: ALICEUSDTPERP is not on Binance Needs ALPHAUSDTPERP D data, not available: ALPHAUSDTPERP is not on Binance Needs ANTUSDTPERP D data, not available: ANTUSDTPERP is not on Binance Needs API3USDTPERP D data, not available: API3USDTPERP is not on Binance Needs ARUSDTPERP D data, not available: ARUSDTPERP is not on Binance Needs ARPAUSDTPERP D data, not available: ARPAUSDTPERP is not on Binance Needs AUDIOUSDTPERP D data, not available: AUDIOUSDTPERP is not on Binance Values that depend on it are empty on this chart.
- Net profit
- −0.48%
- −$4,757.61
- Buy and hold
- +102.5%
- same period
- Closed trades
- 38
- 11 won · 27 lost
- Profitable
- 28.9%
- of closed trades
- Profit factor
- 0.97
- gross profit ÷ gross loss
- Max drawdown
- 6.12%
- −$62,804.40
One run with the author's default settings, $1,000,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
1 setting does nothing
“=Backtest Inputs=” is declared but never read.
-
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
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses an argument v6 removed
when = on line 149, 151. The upgraded version below moves each call inside an if block.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Source | close | source | vud1 vdd1 VAR WWMA zxEMAData ZLEMA lrc lrc1 TSF ma MAvg buySignalc sellSignallc Price Cross Alert Price Crossover Alarm Price Crossunder Alarm |
| OTT Period | 4 | int · min 1 | valpha VAR wwalpha WWMA zxLag ZLEMA lrc lrc1 TSF ma MAvg Trend Tsl t01 s01 t02 s02 t03 s03 t04 s04 t05 s05 t06 s06 t07 s07 t08 s08 t09 s09 t010 s010 t011 s011 t012 s012 t013 s013 t014 s014 t015 s015 t016 s016 t017 s017 t018 s018 t019 s019 t020 s020 t021 s021 t022 s022 t023 s023 t024 s024 t025 s025 t026 s026 t027 s027 t028 s028 t029 s029 t030 s030 t031 s031 t032 s032 t033 s033 t034 s034 t035 s035 t036 s036 t037 s037 t038 s038 t039 s039 t040 s040 |
| OTT Percent | 4.2 | float · min 0 · step 0.1 | fark OTT Up Dn Trend Tsl t01 s01 t02 s02 t03 s03 t04 s04 t05 s05 t06 s06 t07 s07 t08 s08 t09 s09 t010 s010 t011 s011 t012 s012 t013 s013 t014 s014 t015 s015 t016 s016 t017 s017 t018 s018 t019 s019 t020 s020 t021 s021 t022 s022 t023 s023 t024 s024 t025 s025 t026 s026 t027 s027 t028 s028 t029 s029 t030 s030 t031 s031 t032 s032 t033 s033 t034 s034 t035 s035 t036 s036 t037 s037 t038 s038 t039 s039 t040 s040 |
| Show Support Line? | true | bool | Support Line |
| Show Support Line Crossing Signals? | true | bool | Buy Sell |
| Show Price/OTT Crossing Signals? | false | bool | Buy Sell |
| Show OTT Color Changes? | false | bool | OTTC |
| Show OTT Color Change Signals? | false | bool | Buy Sell |
| Highlighter On/Off ? | true | bool | longFillColor shortFillColor |
| Moving Average Type | VAR | string · options ['SMA', 'EMA', 'WMA', 'TMA', 'VAR', 'WWMA', 'ZLEMA', 'TSF'] | line 47 line 50 line 53 line 56 line 59 line 62 line 65 line 68 |
| Show Screener Label | true | bool | _lblscr |
| Pos. Label x-axis | 20 | int | _lblscr |
| Pos. Size Label y-axis | 1 | int | _lblscr |
| Label Color | Blue | string · options ['White', 'Black', 'Red', 'Green', 'Yellow', 'Blue'] | line 119 line 122 line 125 line 128 line 131 line 134 |
| =Backtest Inputs= | true | bool | unused |
| From Day | 1 | int · min 1 · max 31 | Start |
| From Month | 1 | int · min 1 · max 12 | Start |
| From Year | 2005 | int · min 2005 | Start |
| To Day | 1 | int · min 1 · max 31 | Finish |
| To Month | 1 | int · min 1 · max 12 | Finish |
| To Year | 9999 | int · min 2006 | Finish |
| Symbol 01 | NIFTY | symbol | t01 s01 pot_label scr_label up_label dn_label |
| Symbol 02 | S68 | symbol | t02 s02 pot_label scr_label up_label dn_label |
| Symbol 03 | 1000SHIBUSDTPERP | symbol | t03 s03 pot_label scr_label up_label dn_label |
| Symbol 04 | 1INCHUSDTPERP | symbol | t04 s04 pot_label scr_label up_label dn_label |
| Symbol 05 | ALGOUSDTPERP | symbol | t05 s05 pot_label scr_label up_label dn_label |
| Symbol 06 | ALICEUSDTPERP | symbol | t06 s06 pot_label scr_label up_label dn_label |
| Symbol 07 | ALPHAUSDTPERP | symbol | t07 s07 pot_label scr_label up_label dn_label |
| Symbol 08 | ANTUSDTPERP | symbol | t08 s08 pot_label scr_label up_label dn_label |
| Symbol 09 | API3USDTPERP | symbol | t09 s09 pot_label scr_label up_label dn_label |
| Symbol 10 | ARUSDTPERP | symbol | t010 s010 pot_label scr_label up_label dn_label |
| Symbol 11 | ARPAUSDTPERP | symbol | t011 s011 pot_label scr_label up_label dn_label |
| Symbol 12 | AUDIOUSDTPERP | symbol | t012 s012 pot_label scr_label up_label dn_label |
| Symbol 13 | | symbol | t013 s013 pot_label scr_label up_label dn_label |
| Symbol 14 | | symbol | t014 s014 pot_label scr_label up_label dn_label |
| Symbol 15 | | symbol | t015 s015 pot_label scr_label up_label dn_label |
| Symbol 16 | | symbol | t016 s016 pot_label scr_label up_label dn_label |
| Symbol 17 | | symbol | t017 s017 pot_label scr_label up_label dn_label |
| Symbol 18 | | symbol | t018 s018 pot_label scr_label up_label dn_label |
| Symbol 19 | | symbol | t019 s019 pot_label scr_label up_label dn_label |
| Symbol 20 | | symbol | t020 s020 pot_label scr_label up_label dn_label |
| Symbol 21 | | symbol | t021 s021 pot_label scr_label up_label dn_label |
| Symbol 22 | | symbol | t022 s022 t032 s032 pot_label scr_label up_label dn_label |
| Symbol 23 | | symbol | t023 s023 pot_label scr_label up_label dn_label |
| Symbol 24 | | symbol | t024 s024 pot_label scr_label up_label dn_label |
| Symbol 25 | | symbol | t025 s025 pot_label scr_label up_label dn_label |
| Symbol 26 | | symbol | t026 s026 pot_label scr_label up_label dn_label |
| Symbol 27 | | symbol | t027 s027 pot_label scr_label up_label dn_label |
| Symbol 28 | | symbol | t028 s028 pot_label scr_label up_label dn_label |
| Symbol 29 | | symbol | t029 s029 pot_label scr_label up_label dn_label |
| Symbol 30 | | symbol | t030 s030 pot_label scr_label up_label dn_label |
| Symbol 31 | | symbol | t031 s031 pot_label scr_label up_label dn_label |
| Symbol 32 | | symbol | pot_label scr_label up_label dn_label |
| Symbol 33 | | symbol | t033 s033 pot_label scr_label up_label dn_label |
| Symbol 34 | | symbol | t034 s034 pot_label scr_label up_label dn_label |
| Symbol 35 | | symbol | t035 s035 pot_label scr_label up_label dn_label |
| Symbol 36 | | symbol | t036 s036 pot_label scr_label up_label dn_label |
| Symbol 37 | | symbol | t037 s037 pot_label scr_label up_label dn_label |
| Symbol 38 | | symbol | t038 s038 pot_label scr_label up_label dn_label |
| Symbol 39 | | symbol | t039 s039 pot_label scr_label up_label dn_label |
| Symbol 40 | | symbol | t040 s040 pot_label scr_label up_label dn_label |
What it calculates
- LinregSource (close), OTT Period (4), 0
lrc · line 39 - LinregSource (close), OTT Period (4), 1
lrc1 · line 40 - SMA / EMA / WMASource (close), OTT Period (4)
ma · line 48 - CrossoverMAvg, OTT[2]
buySignalk · line 97 - CrossunderMAvg, OTT[2]
sellSignallk · line 99 - CrossoverSource (close), OTT[2]
buySignalc · line 101 - CrossunderSource (close), OTT[2]
sellSignallc · line 103 - CrossoverOTT[2], OTT[3]
buySignalr · line 110 - CrossunderOTT[2], OTT[3]
sellSignallr · line 112
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.
The script has 191 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | Timerange() | On | 149 |
| Open Short short | Timerange() | On | 151 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| Color ALARM | alertcondition | OTT Has Changed Color! | 88 |
| GREEN ALERT | alertcondition | OTT GREEN BUY SIGNAL! | 89 |
| RED ALERT | alertcondition | OTT RED SELL SIGNAL! | 90 |
| Cross Alert | alertcondition | OTT - Support Line Crossing! | 91 |
| Crossover Alarm | alertcondition | Support Line BUY SIGNAL! | 92 |
| Crossunder Alarm | alertcondition | Support Line SELL SIGNAL! | 93 |
| Price Cross Alert | alertcondition | OTT - Price Crossing! | 94 |
| Price Crossover Alarm | alertcondition | PRICE OVER OTT - BUY SIGNAL! | 95 |
| Price Crossunder Alarm | alertcondition | PRICE UNDER OTT - SELL SIGNAL! | 96 |
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe data40 request.security call(s), none with lookahead on.
- 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 NIFTY D, S68 D, 1000SHIBUSDTPERP D, 1INCHUSDTPERP D, ALGOUSDTPERP D, ALICEUSDTPERP D, ALPHAUSDTPERP D, ANTUSDTPERP D, API3USDTPERP D, ARUSDTPERP D, ARPAUSDTPERP D, AUDIOUSDTPERP D, and that data is not available here (NIFTY is not on Binance; not a Binance spot market; 1000SHIBUSDTPERP is not on Binance; 1INCHUSDTPERP is not on Binance; ALGOUSDTPERP is not on Binance; ALICEUSDTPERP is not on Binance; ALPHAUSDTPERP is not on Binance; ANTUSDTPERP is not on Binance; API3USDTPERP is not on Binance; ARUSDTPERP is not on Binance; ARPAUSDTPERP is not on Binance; AUDIOUSDTPERP is not on Binance). Its results would rest on empty values.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 12 | 17% | −$40,653.10 |
| Sideways market | 17 | 35% | $19,821.50 |
| Falling market | 9 | 33% | $16,074.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
8.3%
The 95th percentile of the worst drawdown when the same 38 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 3.7% to 8.3%; the tick is what actually happened, 5.3%. Order luck alone moves it this much.
All 38 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 4 Feb 2024 43,011.10 | 23 Mar 2024 63,796.60 | 48 | $20,785.50 |
| short | 23 Mar 2024 63,796.60 | 29 Mar 2024 70,780.60 | 6 | −$6,983.96 |
| long | 29 Mar 2024 70,780.60 | 16 Apr 2024 63,420.00 | 18 | −$7,360.61 |
| short | 16 Apr 2024 63,420.00 | 18 May 2024 67,024.00 | 32 | −$3,604.01 |
| long | 18 May 2024 67,024.00 | 16 Jun 2024 66,228.30 | 29 | −$795.75 |
| short | 16 Jun 2024 66,228.30 | 16 Jul 2024 64,724.10 | 30 | $1,504.19 |
| long | 16 Jul 2024 64,724.10 | 4 Aug 2024 60,698.00 | 19 | −$4,026.07 |
| short | 4 Aug 2024 60,698.00 | 24 Aug 2024 64,037.20 | 20 | −$3,339.25 |
| long | 24 Aug 2024 64,037.20 | 2 Sep 2024 57,301.80 | 9 | −$6,735.47 |
| short | 2 Sep 2024 57,301.80 | 16 Sep 2024 59,132.00 | 14 | −$1,830.23 |
| long | 16 Sep 2024 59,132.00 | 6 Oct 2024 62,058.00 | 20 | $2,926.01 |
| short | 6 Oct 2024 62,058.00 | 16 Oct 2024 67,074.10 | 10 | −$5,016.13 |
| long | 16 Oct 2024 67,074.10 | 27 Dec 2024 95,791.60 | 72 | $28,717.50 |
| short | 27 Dec 2024 95,791.60 | 18 Jan 2025 104,077.00 | 22 | −$8,285.87 |
| long | 18 Jan 2025 104,077.00 | 6 Feb 2025 96,612.40 | 19 | −$7,465.03 |
| short | 6 Feb 2025 96,612.40 | 21 Apr 2025 85,179.20 | 74 | $11,433.20 |
| long | 21 Apr 2025 85,179.20 | 6 Jun 2025 101,509.00 | 46 | $16,329.40 |
| short | 6 Jun 2025 101,509.00 | 10 Jun 2025 110,263.00 | 4 | −$8,754.33 |
| long | 10 Jun 2025 110,263.00 | 21 Jun 2025 103,298.00 | 11 | −$6,965.04 |
| short | 21 Jun 2025 103,298.00 | 1 Jul 2025 107,147.00 | 10 | −$3,848.53 |
| long | 1 Jul 2025 107,147.00 | 4 Aug 2025 114,209.00 | 34 | $7,062.30 |
| short | 4 Aug 2025 114,209.00 | 11 Aug 2025 119,294.00 | 7 | −$5,085.46 |
| long | 11 Aug 2025 119,294.00 | 25 Aug 2025 113,494.00 | 14 | −$5,800.68 |
| short | 25 Aug 2025 113,494.00 | 14 Sep 2025 115,918.00 | 20 | −$2,424.70 |
| long | 14 Sep 2025 115,918.00 | 26 Sep 2025 108,994.00 | 12 | −$6,923.80 |
| short | 26 Sep 2025 108,994.00 | 3 Oct 2025 120,529.00 | 7 | −$11,534.90 |
| long | 3 Oct 2025 120,529.00 | 12 Oct 2025 110,644.00 | 9 | −$9,884.95 |
| short | 12 Oct 2025 110,644.00 | 5 Dec 2025 92,078.10 | 54 | $18,566.30 |
| long | 5 Dec 2025 92,078.10 | 17 Dec 2025 87,863.40 | 12 | −$4,214.63 |
| short | 17 Dec 2025 87,863.40 | 6 Jan 2026 93,859.70 | 20 | −$5,996.28 |
| long | 6 Jan 2026 93,859.70 | 24 Jan 2026 89,600.30 | 18 | −$4,259.45 |
| short | 24 Jan 2026 89,600.30 | 6 Mar 2026 70,891.00 | 41 | $18,709.20 |
| long | 6 Mar 2026 70,891.00 | 28 Mar 2026 66,407.30 | 22 | −$4,483.74 |
| short | 28 Mar 2026 66,407.30 | 9 Apr 2026 71,069.90 | 12 | −$4,662.65 |
| long | 9 Apr 2026 71,069.90 | 21 May 2026 77,552.20 | 42 | $6,482.31 |
| short | 21 May 2026 77,552.20 | 16 Jun 2026 66,328.70 | 26 | $11,223.50 |
| long | 16 Jun 2026 66,328.70 | 25 Jun 2026 61,078.00 | 9 | −$5,250.74 |
| short | 25 Jun 2026 61,078.00 | 7 Jul 2026 64,042.90 | 12 | −$2,964.93 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| AC- MY SCRIPT1 this page | — | v5 strategy | −0.5% | 38 | 6.1% |
| MACD ReLoaded STRATEGY by KivancOzbilgic | ema linreg wma sma | v5 strategy | +7.8% | 31 | 5.1% |
| Linear Regression MA - Strategy by lazy_capitalist | sma linreg ema | v5 strategy | −1,240.4% | 10 | 318.7% |
| Forex SWING Trader by SoftKill21 | wma ema sma | v4 strategy | No trades on this market | ||
| DRSI DMA Scalping Strategy No Repaint by allenlk | sma wma ema | v4 strategy | −99.5% | 44 | 137.7% |
| Profit Maximizer PMax Strategy - Long-Short by melihtuna | sma ema linreg | v4 strategy | +16.2% | 4 | 27.8% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 2 strategy calls use the when = argument (line 149, 151). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 11 settings use the untyped input() (line 5, 8, 9, 10, 11, 12, 13, 114, 115, 116, 137). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 38 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 5: input() → input.source()
- Line 8: input() → input.bool()
- Line 9: input() → input.bool()
- Line 10: input() → input.bool()
- Line 11: input() → input.bool()
- Line 12: input() → input.bool()
7 more edits
- Line 13: input() → input.bool()
- Line 114: input() → input.bool()
- Line 115: input() → input.int()
- Line 116: input() → input.int()
- Line 137: input() → input.bool()
- Line 149: when = Timerange() → if block
- Line 151: when = Timerange() → if block
⋯strategy('AC- MY SCRIPT1', 'AC- MS1', overlay=true)-src = input(close, title='Source')+src = input.source(close, title='Source')length = input.int(4, 'OTT Period', minval=1)percent = input.float(4.2, 'OTT Percent', step=0.1, minval=0)-showsupport = input(title='Show Support Line?', defval=true)+showsupport = input.bool(title='Show Support Line?', defval=true)-showsignalsk = input(title='Show Support Line Crossing Signals?', defval=true)+showsignalsk = input.bool(title='Show Support Line Crossing Signals?', defval=true)-showsignalsc = input(title='Show Price/OTT Crossing Signals?', defval=false)+showsignalsc = input.bool(title='Show Price/OTT Crossing Signals?', defval=false)-highlight = input(title='Show OTT Color Changes?', defval=false)+highlight = input.bool(title='Show OTT Color Changes?', defval=false)-showsignalsr = input(title='Show OTT Color Change Signals?', defval=false)+showsignalsr = input.bool(title='Show OTT Color Change Signals?', defval=false)-highlighting = input(title='Highlighter On/Off ?', defval=true)+highlighting = input.bool(title='Highlighter On/Off ?', defval=true)mav = input.string(title='Moving Average Type', defval='VAR', options=['SMA', 'EMA', 'WMA', 'TMA', 'VAR', 'WWMA', 'ZLEMA', 'TSF'])⋯plotshape(sellSignallr and showsignalsr ? OTT * 1.005 : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))-showscr = input(true, title='Show Screener Label')+showscr = input.bool(true, title='Show Screener Label')-posX_scr = input(20, title='Pos. Label x-axis')+posX_scr = input.int(20, title='Pos. Label x-axis')-posY_scr = input(1, title='Pos. Size Label y-axis')+posY_scr = input.int(1, title='Pos. Size Label y-axis')colinput = input.string(title='Label Color', defval='Blue', options=['White', 'Black', 'Red', 'Green', 'Yellow', 'Blue'])⋯ col-dummy0 = input(true, title='=Backtest Inputs=')+dummy0 = input.bool(true, title='=Backtest Inputs=')FromDay = input.int(defval=1, title='From Day', minval=1, maxval=31)⋯if buySignalk- strategy.entry('Long', strategy.long, when=Timerange())+ if Timerange()+ strategy.entry('Long', strategy.long)if sellSignallk- strategy.entry('Short', strategy.short, when=Timerange())+ if Timerange()+ strategy.entry('Short', strategy.short)t1 = input.symbol('NIFTY', title='Symbol 01')⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L87:C62: 'plot' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © arjunji4u-//@version=5+//@version=6strategy('AC- MY SCRIPT1', 'AC- MS1', overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 112 ms | With a workaround 1,000 bars in 802 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
“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.
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/// © arjunji4u//@version=5strategy('AC- MY SCRIPT1', 'AC- MS1', overlay=true)src = input(close, title='Source')length = input.int(4, 'OTT Period', minval=1)percent = input.float(4.2, 'OTT Percent', step=0.1, minval=0)showsupport = input(title='Show Support Line?', defval=true)showsignalsk = input(title='Show Support Line Crossing Signals?', defval=true)showsignalsc = input(title='Show Price/OTT Crossing Signals?', defval=false)highlight = input(title='Show OTT Color Changes?', defval=false)showsignalsr = input(title='Show OTT Color Change Signals?', defval=false)highlighting = input(title='Highlighter On/Off ?', defval=true)mav = input.string(title='Moving Average Type', defval='VAR', options=['SMA', 'EMA', 'WMA', 'TMA', 'VAR', 'WWMA', 'ZLEMA', 'TSF'])Var_Func(src, length) => valpha = 2 / (length + 1) vud1 = src > src[1] ? src - src[1] : 0 vdd1 = src < src[1] ? src[1] - src : 0 vUD = math.sum(vud1, 9) vDD = math.sum(vdd1, 9) vCMO = nz((vUD - vDD) / (vUD + vDD)) VAR = 0.0 VAR := nz(valpha * math.abs(vCMO) * src) + (1 - valpha * math.abs(vCMO)) * nz(VAR[1]) VARVAR = Var_Func(src, length)Wwma_Func(src, length) => wwalpha = 1 / length WWMA = 0.0 WWMA := wwalpha * src + (1 - wwalpha) * nz(WWMA[1]) WWMAWWMA = Wwma_Func(src, length)Zlema_Func(src, length) => zxLag = length / 2 == math.round(length / 2) ? length / 2 : (length - 1) / 2 zxEMAData = src + src - src[zxLag] ZLEMA = ta.ema(zxEMAData, length) ZLEMAZLEMA = Zlema_Func(src, length)Tsf_Func(src, length) => lrc = ta.linreg(src, length, 0) lrc1 = ta.linreg(src, length, 1) lrs = lrc - lrc1 TSF = ta.linreg(src, length, 0) + lrs TSFTSF = Tsf_Func(src, length)getMA(src, length) => ma = 0.0 if mav == 'SMA' ma := ta.sma(src, length) ma if mav == 'EMA' ma := ta.ema(src, length) ma if mav == 'WMA' ma := ta.wma(src, length) ma if mav == 'TMA' ma := ta.sma(ta.sma(src, math.ceil(length / 2)), math.floor(length / 2) + 1) ma if mav == 'VAR' ma := VAR ma if mav == 'WWMA' ma := WWMA ma if mav == 'ZLEMA' ma := ZLEMA ma if mav == 'TSF' ma := TSF ma maMAvg = getMA(src, length)fark = MAvg * percent * 0.01longStop = MAvg - farklongStopPrev = nz(longStop[1], longStop)longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStopshortStop = MAvg + farkshortStopPrev = nz(shortStop[1], shortStop)shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStopdir = 1dir := nz(dir[1], dir)dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dirMT = dir == 1 ? longStop : shortStopOTT = MAvg > MT ? MT * (200 + percent) / 200 : MT * (200 - percent) / 200plot(showsupport ? MAvg : na, color=color.new(#0585E1, 0), linewidth=2, title='Support Line')OTTC = highlight ? OTT[2] > OTT[3] ? color.green : color.red : #B800D9pALL = plot(nz(OTT[2]), color=OTTC, linewidth=2, title='OTT', transp=0)alertcondition(ta.cross(OTT[2], OTT[3]), title='Color ALARM', message='OTT Has Changed Color!')alertcondition(ta.crossover(OTT[2], OTT[3]), title='GREEN ALERT', message='OTT GREEN BUY SIGNAL!')alertcondition(ta.crossunder(OTT[2], OTT[3]), title='RED ALERT', message='OTT RED SELL SIGNAL!')alertcondition(ta.cross(MAvg, OTT[2]), title='Cross Alert', message='OTT - Support Line Crossing!')alertcondition(ta.crossover(MAvg, OTT[2]), title='Crossover Alarm', message='Support Line BUY SIGNAL!')alertcondition(ta.crossunder(MAvg, OTT[2]), title='Crossunder Alarm', message='Support Line SELL SIGNAL!')alertcondition(ta.cross(src, OTT[2]), title='Price Cross Alert', message='OTT - Price Crossing!')alertcondition(ta.crossover(src, OTT[2]), title='Price Crossover Alarm', message='PRICE OVER OTT - BUY SIGNAL!')alertcondition(ta.crossunder(src, OTT[2]), title='Price Crossunder Alarm', message='PRICE UNDER OTT - SELL SIGNAL!')buySignalk = ta.crossover(MAvg, OTT[2])plotshape(buySignalk and showsignalsk ? OTT * 0.995 : na, title='Buy', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))sellSignallk = ta.crossunder(MAvg, OTT[2])plotshape(sellSignallk and showsignalsk ? OTT * 1.005 : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))buySignalc = ta.crossover(src, OTT[2])plotshape(buySignalc and showsignalsc ? OTT * 0.995 : na, title='Buy', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))sellSignallc = ta.crossunder(src, OTT[2])plotshape(sellSignallc and showsignalsc ? OTT * 1.005 : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))mPlot = plot(ohlc4, title='', style=plot.style_circles, linewidth=0, display=display.none)longFillColor = highlighting ? MAvg > OTT ? color.green : na : nashortFillColor = highlighting ? MAvg < OTT ? color.red : na : nafill(mPlot, pALL, title='UpTrend Highligter', color=longFillColor, transp=90)fill(mPlot, pALL, title='DownTrend Highligter', color=shortFillColor, transp=90)buySignalr = ta.crossover(OTT[2], OTT[3])plotshape(buySignalr and showsignalsr ? OTT * 0.995 : na, title='Buy', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))sellSignallr = ta.crossunder(OTT[2], OTT[3])plotshape(sellSignallr and showsignalsr ? OTT * 1.005 : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))showscr = input(true, title='Show Screener Label')posX_scr = input(20, title='Pos. Label x-axis')posY_scr = input(1, title='Pos. Size Label y-axis')colinput = input.string(title='Label Color', defval='Blue', options=['White', 'Black', 'Red', 'Green', 'Yellow', 'Blue'])col = color.grayif colinput == 'White' col := color.white colif colinput == 'Black' col := color.black colif colinput == 'Red' col := color.red colif colinput == 'Green' col := color.green colif colinput == 'Yellow' col := color.yellow colif colinput == 'Blue' col := color.blue coldummy0 = input(true, title='=Backtest Inputs=')FromDay = input.int(defval=1, title='From Day', minval=1, maxval=31)FromMonth = input.int(defval=1, title='From Month', minval=1, maxval=12)FromYear = input.int(defval=2005, title='From Year', minval=2005)ToDay = input.int(defval=1, title='To Day', minval=1, maxval=31)ToMonth = input.int(defval=1, title='To Month', minval=1, maxval=12)ToYear = input.int(defval=9999, title='To Year', minval=2006)Start = timestamp(FromYear, FromMonth, FromDay, 00, 00)Finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)Timerange() => time >= Start and time <= Finish ? true : falseif buySignalk strategy.entry('Long', strategy.long, when=Timerange())if sellSignallk strategy.entry('Short', strategy.short, when=Timerange())t1 = input.symbol('NIFTY', title='Symbol 01')t2 = input.symbol('S68', title='Symbol 02')t3 = input.symbol('1000SHIBUSDTPERP', title='Symbol 03')t4 = input.symbol('1INCHUSDTPERP', title='Symbol 04')t5 = input.symbol('ALGOUSDTPERP', title='Symbol 05')t6 = input.symbol('ALICEUSDTPERP', title='Symbol 06')t7 = input.symbol('ALPHAUSDTPERP', title='Symbol 07')t8 = input.symbol('ANTUSDTPERP', title='Symbol 08')t9 = input.symbol('API3USDTPERP', title='Symbol 09')t10 = input.symbol('ARUSDTPERP', title='Symbol 10')t11 = input.symbol('ARPAUSDTPERP', title='Symbol 11')t12 = input.symbol('AUDIOUSDTPERP', title='Symbol 12')t13 = input.symbol('', title='Symbol 13')t14 = input.symbol('', title='Symbol 14')t15 = input.symbol('', title='Symbol 15')t16 = input.symbol('', title='Symbol 16')t17 = input.symbol('', title='Symbol 17')t18 = input.symbol('', title='Symbol 18')t19 = input.symbol('', title='Symbol 19')t20 = input.symbol('', title='Symbol 20')t21 = input.symbol('', title='Symbol 21')t22 = input.symbol('', title='Symbol 22')t23 = input.symbol('', title='Symbol 23')t24 = input.symbol('', title='Symbol 24')t25 = input.symbol('', title='Symbol 25')t26 = input.symbol('', title='Symbol 26')t27 = input.symbol('', title='Symbol 27')t28 = input.symbol('', title='Symbol 28')t29 = input.symbol('', title='Symbol 29')t30 = input.symbol('', title='Symbol 30')t31 = input.symbol('', title='Symbol 31')t32 = input.symbol('', title='Symbol 32')t33 = input.symbol('', title='Symbol 33')t34 = input.symbol('', title='Symbol 34')t35 = input.symbol('', title='Symbol 35')t36 = input.symbol('', title='Symbol 36')t37 = input.symbol('', title='Symbol 37')t38 = input.symbol('', title='Symbol 38')t39 = input.symbol('', title='Symbol 39')t40 = input.symbol('', title='Symbol 40')OTTs(percent, length) => Up = MAvg - MAvg * percent * 0.01 Dn = MAvg + MAvg * percent * 0.01 TrendUp = 0.0 TrendUp := MAvg[1] > TrendUp[1] ? math.max(Up, TrendUp[1]) : Up TrendDown = 0.0 TrendDown := MAvg[1] < TrendDown[1] ? math.min(Dn, TrendDown[1]) : Dn Trend = 0.0 Trend := MAvg > TrendDown[1] ? 1 : MAvg < TrendUp[1] ? -1 : nz(Trend[1], 1) Tsl = Trend == 1 ? TrendUp : TrendDown S_Buy = Trend == 1 ? 1 : 0 S_Sell = Trend != 1 ? 1 : 0 [Trend, Tsl][Trend, Tsl] = OTTs(percent, length)TrendReversal = Trend != Trend[1][t01, s01] = request.security(t1, timeframe.period, OTTs(percent, length))[t02, s02] = request.security(t2, timeframe.period, OTTs(percent, length))[t03, s03] = request.security(t3, timeframe.period, OTTs(percent, length))[t04, s04] = request.security(t4, timeframe.period, OTTs(percent, length))[t05, s05] = request.security(t5, timeframe.period, OTTs(percent, length))[t06, s06] = request.security(t6, timeframe.period, OTTs(percent, length))[t07, s07] = request.security(t7, timeframe.period, OTTs(percent, length))[t08, s08] = request.security(t8, timeframe.period, OTTs(percent, length))[t09, s09] = request.security(t9, timeframe.period, OTTs(percent, length))[t010, s010] = request.security(t10, timeframe.period, OTTs(percent, length))[t011, s011] = request.security(t11, timeframe.period, OTTs(percent, length))[t012, s012] = request.security(t12, timeframe.period, OTTs(percent, length))[t013, s013] = request.security(t13, timeframe.period, OTTs(percent, length))[t014, s014] = request.security(t14, timeframe.period, OTTs(percent, length))[t015, s015] = request.security(t15, timeframe.period, OTTs(percent, length))[t016, s016] = request.security(t16, timeframe.period, OTTs(percent, length))[t017, s017] = request.security(t17, timeframe.period, OTTs(percent, length))[t018, s018] = request.security(t18, timeframe.period, OTTs(percent, length))[t019, s019] = request.security(t19, timeframe.period, OTTs(percent, length))[t020, s020] = request.security(t20, timeframe.period, OTTs(percent, length))[t021, s021] = request.security(t21, timeframe.period, OTTs(percent, length))[t022, s022] = request.security(t22, timeframe.period, OTTs(percent, length))[t023, s023] = request.security(t23, timeframe.period, OTTs(percent, length))[t024, s024] = request.security(t24, timeframe.period, OTTs(percent, length))[t025, s025] = request.security(t25, timeframe.period, OTTs(percent, length))[t026, s026] = request.security(t26, timeframe.period, OTTs(percent, length))[t027, s027] = request.security(t27, timeframe.period, OTTs(percent, length))[t028, s028] = request.security(t28, timeframe.period, OTTs(percent, length))[t029, s029] = request.security(t29, timeframe.period, OTTs(percent, length))[t030, s030] = request.security(t30, timeframe.period, OTTs(percent, length))[t031, s031] = request.security(t31, timeframe.period, OTTs(percent, length))[t032, s032] = request.security(t22, timeframe.period, OTTs(percent, length))[t033, s033] = request.security(t33, timeframe.period, OTTs(percent, length))[t034, s034] = request.security(t34, timeframe.period, OTTs(percent, length))[t035, s035] = request.security(t35, timeframe.period, OTTs(percent, length))[t036, s036] = request.security(t36, timeframe.period, OTTs(percent, length))[t037, s037] = request.security(t37, timeframe.period, OTTs(percent, length))[t038, s038] = request.security(t38, timeframe.period, OTTs(percent, length))[t039, s039] = request.security(t39, timeframe.period, OTTs(percent, length))[t040, s040] = request.security(t40, timeframe.period, OTTs(percent, length))tr01 = t01 != t01[1]up01 = t01 == 1dn01 = t01 == -1tr02 = t02 != t02[1]up02 = t02 == 1dn02 = t02 == -1tr03 = t03 != t03[1]up03 = t03 == 1dn03 = t03 == -1tr04 = t04 != t04[1]up04 = t04 == 1dn04 = t04 == -1tr05 = t05 != t05[1]up05 = t05 == 1dn05 = t05 == -1tr06 = t06 != t06[1]up06 = t06 == 1dn06 = t06 == -1tr07 = t07 != t07[1]up07 = t07 == 1dn07 = t07 == -1tr08 = t08 != t08[1]up08 = t08 == 1dn08 = t08 == -1tr09 = t09 != t09[1]up09 = t09 == 1dn09 = t09 == -1tr010 = t010 != t010[1]up010 = t010 == 1dn010 = t010 == -1tr011 = t011 != t011[1]up011 = t011 == 1dn011 = t011 == -1tr012 = t012 != t012[1]up012 = t012 == 1dn012 = t012 == -1tr013 = t013 != t013[1]up013 = t013 == 1dn013 = t013 == -1tr014 = t014 != t014[1]up014 = t014 == 1dn014 = t014 == -1tr015 = t015 != t015[1]up015 = t015 == 1dn015 = t015 == -1tr016 = t016 != t016[1]up016 = t016 == 1dn016 = t016 == -1tr017 = t017 != t017[1]up017 = t017 == 1dn017 = t017 == -1tr018 = t018 != t018[1]up018 = t018 == 1dn018 = t018 == -1tr019 = t019 != t019[1]up019 = t019 == 1dn019 = t019 == -1tr020 = t020 != t020[1]up020 = t020 == 1dn020 = t020 == -1tr021 = t021 != t021[1]up021 = t021 == 1dn021 = t021 == -1tr022 = t022 != t022[1]up022 = t022 == 1dn022 = t022 == -1tr023 = t023 != t023[1]up023 = t023 == 1dn023 = t023 == -1tr024 = t024 != t024[1]up024 = t024 == 1dn024 = t024 == -1tr025 = t025 != t025[1]up025 = t025 == 1dn025 = t025 == -1tr026 = t026 != t026[1]up026 = t026 == 1dn026 = t026 == -1tr027 = t027 != t027[1]up027 = t027 == 1dn027 = t027 == -1tr028 = t028 != t028[1]up028 = t028 == 1dn028 = t028 == -1tr029 = t029 != t029[1]up029 = t029 == 1dn029 = t029 == -1tr030 = t030 != t030[1]up030 = t030 == 1dn030 = t030 == -1tr031 = t031 != t031[1]up031 = t031 == 1dn031 = t031 == -1tr032 = t032 != t032[1]up032 = t032 == 1dn032 = t032 == -1tr033 = t033 != t033[1]up033 = t033 == 1dn033 = t033 == -1tr034 = t034 != t034[1]up034 = t034 == 1dn034 = t034 == -1tr035 = t035 != t035[1]up035 = t035 == 1dn035 = t035 == -1tr036 = t036 != t036[1]up036 = t036 == 1dn036 = t036 == -1tr037 = t037 != t037[1]up037 = t037 == 1dn037 = t037 == -1tr038 = t038 != t038[1]up038 = t038 == 1dn038 = t038 == -1tr039 = t039 != t039[1]up039 = t039 == 1dn039 = t039 == -1tr040 = t040 != t040[1]up040 = t040 == 1dn040 = t040 == -1pot_label = 'Potential Reversal: \n'pot_label := tr01 ? pot_label + t1 + '\n' : pot_labelpot_label := tr02 ? pot_label + t2 + '\n' : pot_labelpot_label := tr03 ? pot_label + t3 + '\n' : pot_labelpot_label := tr04 ? pot_label + t4 + '\n' : pot_labelpot_label := tr05 ? pot_label + t5 + '\n' : pot_labelpot_label := tr06 ? pot_label + t6 + '\n' : pot_labelpot_label := tr07 ? pot_label + t7 + '\n' : pot_labelpot_label := tr08 ? pot_label + t8 + '\n' : pot_labelpot_label := tr09 ? pot_label + t9 + '\n' : pot_labelpot_label := tr010 ? pot_label + t10 + '\n' : pot_labelpot_label := tr011 ? pot_label + t11 + '\n' : pot_labelpot_label := tr012 ? pot_label + t12 + '\n' : pot_labelpot_label := tr013 ? pot_label + t13 + '\n' : pot_labelpot_label := tr014 ? pot_label + t14 + '\n' : pot_labelpot_label := tr015 ? pot_label + t15 + '\n' : pot_labelpot_label := tr016 ? pot_label + t16 + '\n' : pot_labelpot_label := tr017 ? pot_label + t17 + '\n' : pot_labelpot_label := tr018 ? pot_label + t18 + '\n' : pot_labelpot_label := tr019 ? pot_label + t19 + '\n' : pot_labelpot_label := tr020 ? pot_label + t20 + '\n' : pot_labelpot_label := tr021 ? pot_label + t21 + '\n' : pot_labelpot_label := tr022 ? pot_label + t22 + '\n' : pot_labelpot_label := tr023 ? pot_label + t23 + '\n' : pot_labelpot_label := tr024 ? pot_label + t24 + '\n' : pot_labelpot_label := tr025 ? pot_label + t25 + '\n' : pot_labelpot_label := tr026 ? pot_label + t26 + '\n' : pot_labelpot_label := tr027 ? pot_label + t27 + '\n' : pot_labelpot_label := tr028 ? pot_label + t28 + '\n' : pot_labelpot_label := tr029 ? pot_label + t29 + '\n' : pot_labelpot_label := tr030 ? pot_label + t30 + '\n' : pot_labelpot_label := tr031 ? pot_label + t31 + '\n' : pot_labelpot_label := tr032 ? pot_label + t32 + '\n' : pot_labelpot_label := tr033 ? pot_label + t33 + '\n' : pot_labelpot_label := tr034 ? pot_label + t34 + '\n' : pot_labelpot_label := tr035 ? pot_label + t35 + '\n' : pot_labelpot_label := tr036 ? pot_label + t36 + '\n' : pot_labelpot_label := tr037 ? pot_label + t37 + '\n' : pot_labelpot_label := tr038 ? pot_label + t38 + '\n' : pot_labelpot_label := tr039 ? pot_label + t39 + '\n' : pot_labelpot_label := tr040 ? pot_label + t40 + '\n' : pot_labelscr_label = 'Confirmed Reversal: \n'scr_label := tr01[1] ? scr_label + t1 + '\n' : scr_labelscr_label := tr02[1] ? scr_label + t2 + '\n' : scr_labelscr_label := tr03[1] ? scr_label + t3 + '\n' : scr_labelscr_label := tr04[1] ? scr_label + t4 + '\n' : scr_labelscr_label := tr05[1] ? scr_label + t5 + '\n' : scr_labelscr_label := tr06[1] ? scr_label + t6 + '\n' : scr_labelscr_label := tr07[1] ? scr_label + t7 + '\n' : scr_labelscr_label := tr08[1] ? scr_label + t8 + '\n' : scr_labelscr_label := tr09[1] ? scr_label + t9 + '\n' : scr_labelscr_label := tr010[1] ? scr_label + t10 + '\n' : scr_labelscr_label := tr011[1] ? scr_label + t11 + '\n' : scr_labelscr_label := tr012[1] ? scr_label + t12 + '\n' : scr_labelscr_label := tr013[1] ? scr_label + t13 + '\n' : scr_labelscr_label := tr014[1] ? scr_label + t14 + '\n' : scr_labelscr_label := tr015[1] ? scr_label + t15 + '\n' : scr_labelscr_label := tr016[1] ? scr_label + t16 + '\n' : scr_labelscr_label := tr017[1] ? scr_label + t17 + '\n' : scr_labelscr_label := tr018[1] ? scr_label + t18 + '\n' : scr_labelscr_label := tr019[1] ? scr_label + t19 + '\n' : scr_labelscr_label := tr020[1] ? scr_label + t20 + '\n' : scr_labelscr_label := tr021[1] ? scr_label + t21 + '\n' : scr_labelscr_label := tr022[1] ? scr_label + t22 + '\n' : scr_labelscr_label := tr023[1] ? scr_label + t23 + '\n' : scr_labelscr_label := tr024[1] ? scr_label + t24 + '\n' : scr_labelscr_label := tr025[1] ? scr_label + t25 + '\n' : scr_labelscr_label := tr026[1] ? scr_label + t26+ '\n' : scr_labelscr_label := tr027[1] ? scr_label + t27 + '\n' : scr_labelscr_label := tr028[1] ? scr_label + t28 + '\n' : scr_labelscr_label := tr029[1] ? scr_label + t29 + '\n' : scr_labelscr_label := tr030[1] ? scr_label + t30 + '\n' : scr_labelscr_label := tr031[1] ? scr_label + t31 + '\n' : scr_labelscr_label := tr032[1] ? scr_label + t32 + '\n' : scr_labelscr_label := tr033[1] ? scr_label + t33 + '\n' : scr_labelscr_label := tr034[1] ? scr_label + t34 + '\n' : scr_labelscr_label := tr035[1] ? scr_label + t35 + '\n' : scr_labelscr_label := tr036[1] ? scr_label + t36 + '\n' : scr_labelscr_label := tr037[1] ? scr_label + t37 + '\n' : scr_labelscr_label := tr038[1] ? scr_label + t38 + '\n' : scr_labelscr_label := tr039[1] ? scr_label + t39 + '\n' : scr_labelscr_label := tr040[1] ? scr_label + t40 + '\n' : scr_labelup_label = 'Uptrend: \n'up_label := up01[1] ? up_label + t1 + '\n' : up_labelup_label := up02[1] ? up_label + t2 + '\n' : up_labelup_label := up03[1] ? up_label + t3 + '\n' : up_labelup_label := up04[1] ? up_label + t4 + '\n' : up_labelup_label := up05[1] ? up_label + t5 + '\n' : up_labelup_label := up06[1] ? up_label + t6 + '\n' : up_labelup_label := up07[1] ? up_label + t7 + '\n' : up_labelup_label := up08[1] ? up_label + t8 + '\n' : up_labelup_label := up09[1] ? up_label + t9 + '\n' : up_labelup_label := up010[1] ? up_label + t10 + '\n' : up_labelup_label := up011[1] ? up_label + t11 + '\n' : up_labelup_label := up012[1] ? up_label + t12 + '\n' : up_labelup_label := up013[1] ? up_label + t13 + '\n' : up_labelup_label := up014[1] ? up_label + t14 + '\n' : up_labelup_label := up015[1] ? up_label + t15 + '\n' : up_labelup_label := up016[1] ? up_label + t16 + '\n' : up_labelup_label := up017[1] ? up_label + t17 + '\n' : up_labelup_label := up018[1] ? up_label + t18 + '\n' : up_labelup_label := up019[1] ? up_label + t19 + '\n' : up_labelup_label := up020[1] ? up_label + t20 + '\n' : up_labelup_label := up021[1] ? up_label + t21 + '\n' : up_labelup_label := up022[1] ? up_label + t22 + '\n' : up_labelup_label := up023[1] ? up_label + t23 + '\n' : up_labelup_label := up024[1] ? up_label + t24 + '\n' : up_labelup_label := up025[1] ? up_label + t25 + '\n' : up_labelup_label := up026[1] ? up_label + t26 + '\n' : up_labelup_label := up027[1] ? up_label + t27 + '\n' : up_labelup_label := up028[1] ? up_label + t28 + '\n' : up_labelup_label := up029[1] ? up_label + t29 + '\n' : up_labelup_label := up030[1] ? up_label + t30 + '\n' : up_labelup_label := up031[1] ? up_label + t31 + '\n' : up_labelup_label := up032[1] ? up_label + t32 + '\n' : up_labelup_label := up033[1] ? up_label + t33 + '\n' : up_labelup_label := up034[1] ? up_label + t34 + '\n' : up_labelup_label := up035[1] ? up_label + t35 + '\n' : up_labelup_label := up036[1] ? up_label + t36 + '\n' : up_labelup_label := up037[1] ? up_label + t37 + '\n' : up_labelup_label := up038[1] ? up_label + t38 + '\n' : up_labelup_label := up039[1] ? up_label + t39 + '\n' : up_labelup_label := up040[1] ? up_label + t40 + '\n' : up_labeldn_label = 'Downtrend: \n'dn_label := dn01[1] ? dn_label + t1 + '\n' : dn_labeldn_label := dn02[1] ? dn_label + t2 + '\n' : dn_labeldn_label := dn03[1] ? dn_label + t3 + '\n' : dn_labeldn_label := dn04[1] ? dn_label + t4 + '\n' : dn_labeldn_label := dn05[1] ? dn_label + t5 + '\n' : dn_labeldn_label := dn06[1] ? dn_label + t6 + '\n' : dn_labeldn_label := dn07[1] ? dn_label + t7 + '\n' : dn_labeldn_label := dn08[1] ? dn_label + t8 + '\n' : dn_labeldn_label := dn09[1] ? dn_label + t9 + '\n' : dn_labeldn_label := dn010[1] ? dn_label + t10 + '\n' : dn_labeldn_label := dn011[1] ? dn_label + t11 + '\n' : dn_labeldn_label := dn012[1] ? dn_label + t12 + '\n' : dn_labeldn_label := dn013[1] ? dn_label + t13 + '\n' : dn_labeldn_label := dn014[1] ? dn_label + t14 + '\n' : dn_labeldn_label := dn015[1] ? dn_label + t15 + '\n' : dn_labeldn_label := dn016[1] ? dn_label + t16 + '\n' : dn_labeldn_label := dn017[1] ? dn_label + t17 + '\n' : dn_labeldn_label := dn018[1] ? dn_label + t18 + '\n' : dn_labeldn_label := dn019[1] ? dn_label + t19 + '\n' : dn_labeldn_label := dn020[1] ? dn_label + t20 + '\n' : dn_labeldn_label := dn021[1] ? dn_label + t21 + '\n' : dn_labeldn_label := dn022[1] ? dn_label + t22 + '\n' : dn_labeldn_label := dn023[1] ? dn_label + t23 + '\n' : dn_labeldn_label := dn024[1] ? dn_label + t24 + '\n' : dn_labeldn_label := dn025[1] ? dn_label + t25 + '\n' : dn_labeldn_label := dn026[1] ? dn_label + t26 + '\n' : dn_labeldn_label := dn027[1] ? dn_label + t27 + '\n' : dn_labeldn_label := dn028[1] ? dn_label + t28 + '\n' : dn_labeldn_label := dn029[1] ? dn_label + t29 + '\n' : dn_labeldn_label := dn030[1] ? dn_label + t30 + '\n' : dn_labeldn_label := dn031[1] ? dn_label + t31 + '\n' : dn_labeldn_label := dn032[1] ? dn_label + t32 + '\n' : dn_labeldn_label := dn033[1] ? dn_label + t33 + '\n' : dn_labeldn_label := dn034[1] ? dn_label + t34 + '\n' : dn_labeldn_label := dn035[1] ? dn_label + t35 + '\n' : dn_labeldn_label := dn036[1] ? dn_label + t36 + '\n' : dn_labeldn_label := dn037[1] ? dn_label + t37 + '\n' : dn_labeldn_label := dn038[1] ? dn_label + t38 + '\n' : dn_labeldn_label := dn039[1] ? dn_label + t39 + '\n' : dn_labeldn_label := dn040[1] ? dn_label + t40 + '\n' : dn_labelf_colorscr(_valscr) => _valscr ? #00000000 : naf_printscr(_txtscr) => var _lblscr = label(na) label.delete(_lblscr) _lblscr := label.new(time + (time - time[1]) * posX_scr, ohlc4[posY_scr], _txtscr, xloc.bar_time, yloc.price, f_colorscr(showscr), textcolor=showscr ? col : na, size=size.normal, style=label.style_label_center) _lblscrf_printscr(scr_label + '\n' + pot_label + '\n' + up_label + '\n' + dn_label)