Zeal Terminal Open Zeal Terminal

Pine Script v5 · Strategy

X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2

A Pine Script v5 strategy built on SMA (ta.tr, 5), EMA (buycon, 12) and Crossover (newsig, newsig2). It has 299 order rules, 210 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade commits 5% of equity and pays 0.1% commission. 99 settings; defaults include Adaptive ATR Candle Length 5, Adaptive ATR Multiply 0.75 and FAST Adaptive ATR LINE - After Calculate 8.

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 X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2 repaint?
No
No repainting patterns were found in the source.
What alerts does X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2 have?
24
15m BREAK UP; 15m BREAK DOWN; 15m BREAK UP; 15m BREAK DOWN; and more.
Does X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2 run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L1397:C0: no source was supplied for the library 'X4815162342/X48_LibaryStrategyStatus/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
Does X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2 use a stop loss?
Yes
strategy.exit sets a stop on line 1028, 1091, 1154, 1217, 1280, 1285, 1340, 1390, 1392, 1395.
Does X48 - Strategy - BreakOut & Consecutive (11in1) + Alert - V.1.2 run in Zeal Terminal?
No
Not yet: it imports the library X4815162342/X48_LibaryStrategyStatus/2, whose source is not available here, so it does not run here
Does not run in Zeal Terminal yetIt imports the library X4815162342/X48_LibaryStrategyStatus/2, whose source is not available here, so it does not run here. The settings, logic and review below are read from the source, which does not need a run.

Review

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

  • Likely bug

    ta.ema(buycon, 12) ignores the settings line 99

    Line 99 hard-codes 12 where line 101 uses “FAST Adaptive ATR LINE - After Calculate”. Changing those settings moves one band but not this one.

    ta.ema(buycon, 12)ta.ema(buycon, FastEMATR)
  • Likely bug

    ta.ema(sellcon, 12) ignores the settings line 100

    Line 100 hard-codes 12 where line 101 uses “FAST Adaptive ATR LINE - After Calculate”. Changing those settings moves one band but not this one.

    ta.ema(sellcon, 12)ta.ema(sellcon, FastEMATR)
  • Likely bug

    ta.crossover(delta, 0) ignores the settings line 465

    Line 465 hard-codes 0 where line 570 uses “🉐 RSI OverBought”. Changing those settings moves one band but not this one.

    ta.crossover(delta, 0)ta.crossover(delta, RSI_OB)
  • Likely bug

    ta.crossunder(delta, 0) ignores the settings line 466

    Line 466 hard-codes 0 where line 571 uses “🉐 RSI OverSold”. Changing those settings moves one band but not this one.

    ta.crossunder(delta, 0)ta.crossunder(delta, RSI_OS)
  • Check

    1 setting does nothing

    “Alert Message for BOT” is declared but never read.

  • Note

    3 settings have no label

    In the settings dialog tenkan_mult (line 403), kijun_mult (line 405), spanB_mult (line 407) show an empty name. The labels on this page come from the variable names.

Settings

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

SettingDefaultType and rangeFeeds
🍀🍀🍀 SPOT MODE 🍀🍀🍀
🍀 SPOT MODEfalseboolline 157 line 162 line 218 line 223 line 589 line 965 line 1343 line 1371 line 1388 line 1393
1️⃣2️⃣3️⃣4️⃣5️⃣ SELECT [X] STRATEGY + TAKE PROFIT & STOP LOSS ? + CONFIRM MODE ? 5️⃣4️⃣3️⃣2️⃣1️⃣
1️⃣ CHANNEL BREAKOUT MODEUse Channel BreakOut Strategytrueboolentry Short exit Long line 591 line 654 line 717 line 780 line 843 line 906 line 967 line 1030 line 1093 line 1156 line 1219 line 1282
2️⃣ CONSECUTIVE BarsUP/DOWN MODEUse Consecutive Strategyfalseboolentry Long entry Short entry Long entry Short entry Long entry Short entry Long entry Short entry Long entry Short entry Long entry Short entry Long close_all entry Long close_all entry Long close_all entry Long close_all entry Long close_all entry Long close_all line 597 line 599 line 660 line 662 line 723 line 725 line 786 line 788 line 849 line 851 line 911 line 913 line 973 line 975 line 1036 line 1038 line 1099 line 1101 line 1162 line 1164 line 1225 line 1227 line 1287 line 1289
3️⃣ 15m High/Low Range Break MODE [BUY ONLY]falseboollongCondition15 shortCondition15
4️⃣ MA CROSS X STRATEGY MODEfalseboolline 608 line 613 line 671 line 676 line 749 line 754 line 797 line 802 line 860 line 865 line 922 line 927 line 984 line 989 line 1047 line 1052 line 1125 line 1130 line 1173 line 1178 line 1236 line 1241 line 1298 line 1303
4️⃣ 🎯MA CROSS X REPEAT MODERepeat Mode After TP/SL Open Position With Trend Fast >,< Slow Againfalseboolline 608 line 613 line 671 line 676 line 749 line 754 line 797 line 802 line 860 line 865 line 922 line 927 line 984 line 989 line 1047 line 1052 line 1125 line 1130 line 1173 line 1178 line 1236 line 1241 line 1298 line 1303
5️⃣ MACD CROSS [0] STRATEGY MODEfalseboolline 618 line 623 line 628 line 681 line 686 line 691 line 734 line 739 line 744 line 807 line 812 line 817 line 870 line 875 line 880 line 932 line 937 line 942 line 994 line 999 line 1004 line 1057 line 1062 line 1067 line 1110 line 1115 line 1120 line 1183 line 1188 line 1193 line 1246 line 1251 line 1256 line 1308 line 1313 line 1318
5️⃣🎯 MACD CROSS [0] REPEAT MODERepeat Mode After TP/SL Open Position With Trend Fast >,< Slow Againfalseboolline 618 line 623 line 628 line 681 line 686 line 691 line 734 line 739 line 744 line 807 line 812 line 817 line 870 line 875 line 880 line 932 line 937 line 942 line 994 line 999 line 1004 line 1057 line 1062 line 1067 line 1110 line 1115 line 1120 line 1183 line 1188 line 1193 line 1246 line 1251 line 1256 line 1308 line 1313 line 1318
🅰️🅱️ CONFIRM MODE 🅱️🅰️
🅰️ MACD CONFIRM MODEUse MACD For Confirm SignalfalseboolDisable_Confirm line 590 line 905 line 966 line 1281
🉐 RSI CONFIRM MODEUse Stochastic For Confirm SignalfalseboolDisable_Confirm line 653 line 905 line 1029 line 1281
💯 MA CROSS X CONFIRM MODEUse MA Type Cross For Confirm SignalfalseboolDisable_Confirm line 716 line 905 line 1092 line 1281
💮 ICHIMOKU TENKAN&KIJUN CROSS X CONFIRM MODEUse Ichimoku Tenkan & Kijun Cross For Confirm SignalfalseboolDisable_Confirm line 779 line 905 line 1155 line 1281
🍩AROON 100% & -100% CONFIRMfalseboolDisable_Confirm line 842 line 905 line 1218 line 1281
🆎🆑🅾️🆘 TP & SL SELECT MODE 🆘🅾️🆑🆎
🆎 STOP LOSS BY SWING MODEIf Mode On = Use Stop Loss By Last SwingfalseboolTop Levels Bottom Levels Top Levels 2 Bottom Levels 2 line 217
🆑 ATR Trailing StopfalseboolFast Trail Slow Trail line 538
🅾️ CALLBACK Trailing Stop [Low Profit But More TP]BreakOut Length For Who's Want Fast Trailing But This Low Profit But More Time For TP\nIt's Can Combo With Breakout and 15mfalseboolline 156
🆘 Take Profit & Stop Loss By Percent (%)Take Profit & Stop Loss by % Changefalseboolline 1342 line 1387
⭐⭐ Volty Forex & Adaptive ATR Volume Setting ⭐⭐
💵💕 Volty Forex Mode Only & Commission = 0 OnlyForex Mode & Commission = 0 Only & Intitial Cap = 10,000 & Order Size = 100%falseboolentry Long entry Short entry Long exit Spot_ExitFX line 633 line 638 line 643 line 648 line 696 line 701 line 706 line 711 line 759 line 764 line 769 line 774 line 822 line 827 line 832 line 837 line 885 line 890 line 895 line 900 line 947 line 952 line 957 line 962 line 1009 line 1014 line 1019 line 1024 line 1072 line 1077 line 1082 line 1087 line 1135 line 1140 line 1145 line 1150 line 1198 line 1203 line 1208 line 1213 line 1261 line 1266 line 1271 line 1276 line 1323 line 1328 line 1333 line 1338
⭐ Adaptive ATR Volty MODE For CryptoCurrencyFor Forex LotPump Commission = 0, Crypto Commission = 0.1falseboolnewsig newsig2 LongSig ShortSig line 633 line 638 line 643 line 696 line 701 line 706 line 759 line 764 line 769 line 822 line 827 line 832 line 885 line 890 line 895 line 947 line 952 line 957 line 1009 line 1014 line 1019 line 1072 line 1077 line 1082 line 1135 line 1140 line 1145 line 1198 line 1203 line 1208 line 1261 line 1266 line 1271 line 1323 line 1328 line 1333
📌 Repeat Signal After TP/SL ❌ Can't Use With Confirm MODE ❌Repeat New Position After TP and SLfalseboolline 633 line 638 line 643 line 696 line 701 line 706 line 759 line 764 line 769 line 822 line 827 line 832 line 885 line 890 line 895 line 947 line 952 line 957 line 1009 line 1014 line 1019 line 1072 line 1077 line 1082 line 1135 line 1140 line 1145 line 1198 line 1203 line 1208 line 1261 line 1266 line 1271 line 1323 line 1328 line 1333
🎯 Consecutive Bars Filter For Repeat SignalConsecutive Bars Filter For Signal Repeat New Position After TP and SLfalseboolline 633 line 638 line 643 line 696 line 701 line 706 line 759 line 764 line 769 line 822 line 827 line 832 line 885 line 890 line 895 line 947 line 952 line 957 line 1009 line 1014 line 1019 line 1072 line 1077 line 1082 line 1135 line 1140 line 1145 line 1198 line 1203 line 1208 line 1261 line 1266 line 1271 line 1323 line 1328 line 1333
Adaptive ATR Candle Length5int · min 1atrs atr
Adaptive ATR Multiply0.75float · min 0.1atrs
FAST Adaptive ATR LINE - After Calculate8int · min 1newsig
SLOW Adaptive ATR LINE - After Calculate32int · min 1newsig2
Bot Setting \n >> If You Dont Use Bot Just Pass It
Alert Message for BOTAlert For X48-BOT > Copy and Paste To Alert FunctionText_Alert_Futurevalueunused
Bot PassPassphrase Must Be Same as X48-BOT1234stringAlert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort
leverage"NOTHING" to do with Position size For Command To X48-BOT Only125int · min 1Alert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort
Bot Long Command1.OpenLong\n2.AutoLong\n***If AutoLong = Close(100%) First > Open Long Position AutoAutoLongstringAlert_OpenLong
Bot Short Command1.OpenShort\n2.AutoShort\n***If AutoShort = Close(100%) First > Open Short Position AutoAutoShortstringAlert_OpenShort
Future/Spot Command1. bnfuture = FUTURE MODE\n2. bnspot = SPOT MODE\n 3.bncombo = EZ 2in1 OrderbnfuturestringAlert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort
1️⃣1️⃣1️⃣ CHANNEL BREAKOUT STRATEGY 1️⃣1️⃣1️⃣
[PLOT] BreakOut LINE [PLOT]falseboolTop LevelsBO Bottom LevelsBO
1️⃣ Length BreakOut5int · min 1 · max 1000upBound downBound entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long line 592 line 655 line 718 line 781 line 844 line 907 line 968 line 1031 line 1094 line 1157 line 1220 line 1283
🅾️ BreakOut Trailing CALLBACK [%]Binance Callback = 5%, Now You Can Customize Your Callback ><25float · min 0.01 · max 999.99SL_LongBO SL_ShortBO
2️⃣2️⃣2️⃣ Consecutive Up/Down Strategy 2️⃣2️⃣2️⃣
2️⃣ Consecutive BarsUp3int · min 1entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long entry Long line 597 line 660 line 723 line 786 line 849 line 911 line 973 line 1036 line 1099 line 1162 line 1225 line 1287
2️⃣ Consecutive BarsDown3int · min 1entry Short entry Short entry Short entry Short entry Short entry Short close_all close_all close_all close_all close_all close_all line 599 line 662 line 725 line 788 line 851 line 913 line 975 line 1038 line 1101 line 1164 line 1227 line 1289
3️⃣3️⃣3️⃣ 15m BREAK RANGE STRATEGY 3️⃣3️⃣3️⃣
[PLOT] 15m High/Low Range Break [PLOT]falseboolRange H-L H-L SD Close Direction
3️⃣ 15m - Lookback2int · min 1longCondition15 shortCondition15 Close Direction
3️⃣ 15m - Range Length10int · min 1computation
15m - SD2.0float · min 0.001 · max 50computation atr
🆎🆎🆎 TP/SL SWING SETTING 🆎🆎🆎
🆎 Pivot Length Left Hand Side3int · min 1pvthi_ pvtlo_
🆎 Pivot Length Right Hand Side3int · min 1pvthi_ pvtlo_ Top Levels Bottom Levels
ENGULFING SIGNAL
Normal Engulfing Signalfalseboolbarcolor plotshape
3 Candle Engulfing Signalfalseboolplotshape barcolor
💯💯💯4️⃣ Multi MA SETTING 4️⃣💯💯💯
💯4️⃣ Source Multi MANormal Line = Close \nSmooth Line = ohlc4closesourcepricestrategy
Show Fast MA LinefalseboolFast MA Fast MA
Fast MA Colorcolor.new(color.red,0)colorFast MA
Show Slow MA LinefalseboolSlow MA Fast MA
Slow MA Colorcolor.new(color.yellow,0)colorSlow MA
💯4️⃣ Fast MA Length12intprice1strategy
Fast MA TypeSMA / EMA / WMA / HMA / RMA / VWMAEMAstring · options ['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA']price1strategy
💯4️⃣ Slow MA Length26intprice3strategy
Slow MA TypeSMA / EMA / WMA / HMA / RMA / VWMAEMAstring · options ['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA']price3strategy
DONCHIAN FANS MODE
DONCHIAN FANS MODEfalseboolline 385 line 392
DONCHIAN BOLLINGER LINEfalseboolH M L
FANS length:100int · min 1h_price h_bar l_price l_bar r
💮💮💮 ICHIMOKU SETTING 💮💮💮
ICHIMOKU PLOT MODEfalseboolSenkou Span A Senkou Span B Tenkan-Sen Kijun-Sen Crossover Crossunder Chikou
💮 Tenkan TENKAN = FAST SIGNAL9inttenkan
Tenkan mult (no label in the script)2.floattenkan
💮 Kijun KIJUN = SLOW SIGNAL26intkijun
Kijun mult (no label in the script)4.floatkijun
Senkou Span A/B SENKOU = CLOUD SIGNAL52intsenkouB
Span B mult (no label in the script)6.floatsenkouB
CLOUD-Acolor.new(color.orange,20)colorcloud_a
CLOUD-Bcolor.new(color.purple,20)colorcloud_b
Chikou-Colorcolor.new(#73ecff,0)colorChikou
ChikouCHIKOU = CANDLE LOOK BACK DEFAULT = 2626intSenkou Span A Senkou Span B Chikou
🅰️🅰️5️⃣5️⃣ MACD SETTING [PLOT/Confirm]5️⃣5️⃣🅰️🅰️
MACD MODE = MACD Cross SignalIf Mode On = Use MACD Strategy for Signal When Cross Up and Cross DownfalseboolmacdTPl macdTPs
🅰️5️⃣ MACD Fast12intMACD
🅰️5️⃣ MACD Slow26intMACD
🅰️5️⃣ MACD Length18intaMACD
CROSS-UPcolor.new(color.green,0)colormacdTPl
CROSS-DOWNcolor.new(color.red,0)colormacdTPs
🆘🆘🆘 TAKE PROFIT & STOP LOSS BY [%] 🆘🆘🆘
🆘 TP [LONG] %99999floattakeprofit takeprofit_ll line 1350 line 1354 line 1378 line 1382
🆘 TP [SHORT] %33.3floattakeprofit takeprofit_ss line 1362 line 1366
🆘 Stop Loss %0floatstoploss line 1345 line 1348 line 1357 line 1360 line 1373 line 1376
🆑🆑🆑 ATR TRAILING STOP 🆑🆑🆑
🆑 Fast ATR period5intSL1
🆑 Fast ATR multiplier0.5floatSL1
🆑 Slow ATR period10intSL2
🆑 Slow ATR multiplier2floatSL2
🍩🍩🍩 AROON SETTING 🍩🍩🍩
AROON LENGTH14int · min 1AroonUpper AroonLower
🉐 RSI MODE
🉐=== RSI LINE ===falseboolRSIUP RSIDOWN RSI RSI-based MA
🉐 RSI OverBoughtRSI OB50int · min 1 · max 100RSIUP BULLRSI
🉐 RSI OverSoldRSI OS50int · min 1 · max 100RSIDOWN BEARRSI
RSI LENGTHRSI LENGTH14int · min 1 · max 999up down vrsi
RSI SMA LENGTHRSI SMA LENGTH FOR PREDICT TREND50int · min 1 · max 999rsiMA
RSI LINEcolor.whitecolorRSI
SIZEWidth 0-42int · min 0 · max 4RSI
TRNSTransparency 0-1000int · min 0 · max 100RSI
RSIMA LINEcolor.bluecolorRSIc1
RSIMA COL2 (no label in the script)color.tealcolorRSIc1
SIZEWidth 0-43int · min 0 · max 4RSI-based MA
TRNSTransparency 0-1000int · min 0 · max 100RSIc1
INPUT BACKTEST TIME RANGE
StartStart Backtest YYYY/MM/DDtimestamp("01 Jan 1945 00:00 +0000")timeline 587
EndEnd Backtest YYYY/MM/DDtimestamp("01 Jan 2074 23:59 +0000")timeline 587
PNL MONITOR SETTING
Monitor Profit&Losstrueboolline 1403
Positionbottom_centerstring · options ['top_right','middle_right','bottom_right','top_center','middle_center','bottom_center','middle_left','bottom_left']line 1403
sizeautostring · options ['auto','tiny','small','normal']line 1403
Color Net (no label in the script)color.bluecolorline 1403

What it calculates

  • SMAta.tr, Adaptive ATR Candle Length (5)atrs · line 95
  • EMAbuycon, 12buysig · line 99
  • EMAsellcon, 12sellsig · line 100
  • EMAnewcon, FAST Adaptive ATR LINE - After Calculate (8)newsig · line 101
  • EMAnewcon, SLOW Adaptive ATR LINE - After Calculate (32)newsig2 · line 102
  • Crossovernewsig, newsig2ATRLCondition · line 103
  • Crossundernewsig, newsig2ATRSCondition · line 104
  • Highesthigh, 1️⃣ Length BreakOut (5)upBound · line 136
  • Lowestlow, 1️⃣ Length BreakOut (5)downBound · line 137
  • Stdev / SMArrange, 3️⃣ 15m - Range Length (10)computation · line 183
  • Pivothighhigh, 🆎 Pivot Length Left Hand Side (3), 🆎 Pivot Length Right Hand Side (3)pvthi_ · line 196
  • Pivotlowlow, 🆎 Pivot Length Left Hand Side (3), 🆎 Pivot Length Right Hand Side (3)pvtlo_ · line 197
  • Crossunderclose, pvtlosstopswinglow · line 215
  • Crossoverclose, pvthisstopswinghigh · line 216
  • EMA / SMA / WMA / HMA / RMA / VWMApricestrategy, 💯4️⃣ Fast MA Length (12) · chosen by Fast MA Typeprice1strategy · line 297
  • EMA / SMA / WMA / HMA / RMA / VWMApricestrategy, 💯4️⃣ Slow MA Length (26) · chosen by Slow MA Typeprice3strategy · line 305
  • Crossoverprice1strategy, price3strategyBullMACross · line 314
  • Crossunderprice1strategy, price3strategyBearMACross · line 315
  • ATRFANS length: (100)r · line 365
  • ATRAdaptive ATR Candle Length (5)atr · line 414
  • RMA / Changemath.max(ta.change(close), 0), RSI LENGTH (14)up · line 566
  • Crosssrc, sptmax · line 424
  • Crosssrc, sptmin · line 425
  • Crossovertenkan, kijunichi_bull · line 445
  • Crossundertenkan, kijunichi_bear · line 446
  • EMAclose, 🅰️5️⃣ MACD Fast (12)MACD · line 462
  • EMAMACD, 🅰️5️⃣ MACD Length (18)aMACD · line 463
  • Crossoverdelta, 0macdTPl · line 465
  • Crossunderdelta, 0macdTPs · line 466
  • ATR🆑 Fast ATR period (5)SL1 · line 521
  • ATR🆑 Slow ATR period (10)SL2 · line 529
  • CrossoverTrail1, Trail2BuyLong · line 534
  • CrossunderTrail1, Trail2SellShort · line 535
  • Highestbarshigh, AROON LENGTH (14)AroonUpper · line 547
  • Lowestbarslow, AROON LENGTH (14)AroonLower · line 548
  • CrossoverAroonUpper, AroonLowerAroonCrossUp · line 549
  • CrossunderAroonUpper, AroonLowerAroonCrossDown · line 550
  • RMA / Change-math.min(ta.change(close), 0), RSI LENGTH (14)down · line 567
  • RSIclose, RSI LENGTH (14)vrsi · line 569
  • Crossovervrsi, 🉐 RSI OverBought (50)RSIUP · line 570
  • Crossundervrsi, 🉐 RSI OverSold (50)RSIDOWN · line 571
  • SMArsi, RSI SMA LENGTH (50)rsiMA · line 572
  • Crossoverrsi, rsiMARSIBULL · line 573
  • Crossunderrsi, rsiMARSIBEAR · line 574

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 240 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Close LongSL_LongBO and strategy.position_size > 0On159
Close ShortSL_ShortBO and strategy.position_size < 0On161
Close LongSL_LongBO and strategy.position_size > 0On164
Close Long(close < pvtlos)On220
Close Short(close > pvthis)On222
Close Long(close < pvtlos)On225
Close ShortBuyLong and strategy.position_size < 0On540
Close LongSellShort and strategy.position_size > 0On542
Open Long longnot na(close[lengthBO]) and MACDBullOn593
Open Short shortMACDBearOn595
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBullOn598
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBearOn600
Open Long long(longCondition15) and MACDBullOn603
Close 15m BREAK DOWN(shortCondition15) and MACDBearOn606
Open Long longBullMACross and MACDBullOn610
Open Short shortBearMACross and MACDBearOn612
Open Long longBullMAPlus and MACDBullOn615
Open Short shortBearMAPlus and MACDBearOn617
Open Long longmacdTPlOn620
Open Short shortmacdTPsOn622
Open Long longMACDBull or macdTPlOn625
Open Short shortMACDBear or macdTPsOn627
Open Long longMACDBullOn630
Open Short shortMACDBearOn632
Open Long longATRLCondition and MACDBullOn635
Open Short shortATRSCondition and MACDBearOn637
Open Long longLongRepeat and MACDBullOn640
Open Short shortShortRepeat and MACDBearOn642
Open Long longLongRepeat and MACDBull and L_ConsecutiveOn645
Open Short shortShortRepeat and MACDBear and S_ConsecutiveOn647
Open Long longMACDBullOn650
Open Short shortMACDBearOn652
Open Long longnot na(close[lengthBO]) and BULLRSIOn656
Open Short shortBEARRSIOn658
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSIOn661
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSIOn663
Open Long long(longCondition15) and BULLRSIOn666
Close 15m BREAK DOWN(shortCondition15) and BEARRSIOn669
Open Long longBullMAPlus and BULLRSIOn673
Open Short shortBearMAPlus and BEARRSIOn675
Open Long longBullMAPlus and BULLRSIOn678
Open Short shortBearMAPlus and BEARRSIOn680
Open Long longmacdTPl and BULLRSIOn683
Open Short shortmacdTPs and BEARRSIOn685
Open Long long(MACDBull and BULLRSI) or (macdTPl and BULLRSI)On688
Open Short short(MACDBear and BEARRSI) or (macdTPs and BEARRSI)On690
Open Long longMACDBull and BULLRSIOn693
Open Short shortMACDBear and BEARRSIOn695
Open Long longATRLCondition and BULLRSIOn698
Open Short shortATRSCondition and BEARRSIOn700
Open Long longLongRepeat and BULLRSIOn703
Open Short shortShortRepeat and BEARRSIOn705
Open Long longLongRepeat and BULLRSI and L_ConsecutiveOn708
Open Short shortShortRepeat and BEARRSI and S_ConsecutiveOn710
Open Long longBULLRSIOn713
Open Short shortBEARRSIOn715
Open Long longnot na(close[lengthBO]) and BullMAPlusOn719
Open Short shortBearMAPlusOn721
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlusOn724
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlusOn726
Open Long long(longCondition15) and BullMAPlusOn729
Close 15m BREAK DOWN(shortCondition15) and BearMAPlusOn732
Open Long long(macdTPl and BullMAPlus) or (MACDBull and BullMAPlus)On736
Open Short short(macdTPs and BearMAPlus) or (MACDBear and BearMAPlus)On738
Open Long long(macdTPl and BullMAPlus)On741
Open Short short(macdTPs and BearMAPlus)On743
Open Long long(MACDBull and BullMAPlus)On746
Open Short short(MACDBear and BearMAPlus)On748
Open Long longBullMACrossOn751
Open Short shortBearMACrossOn753
Open Long longBullMAPlusOn756
Open Short shortBearMAPlusOn758
Open Long longATRLCondition and BullMAPlusOn761
Open Short shortATRSCondition and BearMAPlusOn763
Open Long longLongRepeat and BullMAPlusOn766
Open Short shortShortRepeat and BearMAPlusOn768
Open Long longLongRepeat and BullMAPlus and L_ConsecutiveOn771
Open Short shortShortRepeat and BearMAPlus and S_ConsecutiveOn773
Open Long longBullMAPlusOn776
Open Short shortBearMAPlusOn778
Open Long longnot na(close[lengthBO]) and ichi_bullplusOn782
Open Short shortichi_bearplusOn784
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplusOn787
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplusOn789
Open Long long(longCondition15) and ichi_bullplusOn792
Close 15m BREAK DOWN(shortCondition15) and ichi_bearplusOn795
Open Long longBullMACross and ichi_bullplusOn799
Open Short shortBearMACross and ichi_bearplusOn801
Open Long longBullMAPlus and ichi_bullplusOn804
Open Short shortBearMAPlus and ichi_bearplusOn806
Open Long long(macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus)On809
Open Short short(macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus)On811
Open Long long(macdTPl and ichi_bullplus)On814
Open Short short(macdTPs and ichi_bearplus)On816
Open Long long(MACDBull and ichi_bullplus)On819
Open Short short(MACDBear and ichi_bearplus)On821
Open Long longATRLCondition and ichi_bullplusOn824
Open Short shortATRSCondition and ichi_bearplusOn826
Open Long longLongRepeat and ichi_bullplusOn829
Open Short shortShortRepeat and ichi_bearplusOn831
Open Long longLongRepeat and ichi_bullplus and L_ConsecutiveOn834
Open Short shortShortRepeat and ichi_bearplus and S_ConsecutiveOn836
Open Long longichi_bullplusOn839
Open Short shortichi_bearplusOn841
Open Long longnot na(close[lengthBO]) and AroonHitUpOn845
Open Short shortAroonHitDownOn847
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUpOn850
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDownOn852
Open Long long(longCondition15) and AroonHitUpOn855
Close 15m BREAK DOWN(shortCondition15) and AroonHitDownOn858
Open Long longBullMACross and AroonHitUpOn862
Open Short shortBearMACross and AroonHitDownOn864
Open Long longBullMAPlus and AroonHitUpOn867
Open Short shortBearMAPlus and AroonHitDownOn869
Open Long longmacdTPl and AroonHitUpOn872
Open Short shortmacdTPs and AroonHitDownOn874
Open Long long(macdTPl and AroonHitUp) or (MACDBull and AroonHitUp)On877
Open Short short(macdTPs and AroonHitDown) or (MACDBear and AroonHitDown)On879
Open Long long(MACDBull and AroonHitUp)On882
Open Short short(MACDBear and AroonHitDown)On884
Open Long longATRLCondition and AroonHitUpOn887
Open Short shortATRSCondition and AroonHitDownOn889
Open Long longLongRepeat and AroonHitUpOn892
Open Short shortShortRepeat and AroonHitDownOn894
Open Long longLongRepeat and AroonHitUp and L_ConsecutiveOn897
Open Short shortShortRepeat and AroonHitDown and S_ConsecutiveOn899
Open Long longAroonHitUpOn902
Open Short shortAroonHitDownOn904
Open Long longnot na(close[lengthBO])On908
Open Short shortBreakOut_MODE == trueOn909
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na)On912
Open Short short(Consecutive_MODE ? dns >= consecutiveBarsDown : na)On914
Open Long long(longCondition15)On917
Close 15m BREAK DOWN(shortCondition15)On920
Open Long longBullMACrossOn924
Open Short shortBearMACrossOn926
Open Long longBullMAPlusOn929
Open Short shortBearMAPlusOn931
Open Long longmacdTPlOn934
Open Short shortmacdTPsOn936
Open Long longmacdTPl or MACDBullOn939
Open Short shortmacdTPs or MACDBearOn941
Open Long longMACDBullOn944
Open Short shortMACDBearOn946
Open Long longATRLConditionOn949
Open Short shortATRSConditionOn951
Open Long longLongRepeatOn954
Open Short shortShortRepeatOn956
Open Long longLongRepeat and L_ConsecutiveOn959
Open Short shortShortRepeat and S_ConsecutiveOn961
Open Long longForex_mode == trueOn963
Open Short shortForex_mode == trueOn964
Open Long longnot na(close[lengthBO]) and MACDBullOn969
Close MACDBearOn971
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBullOn974
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBearOn976
Open Long long(longCondition15) and MACDBullOn979
Close 15m BREAK DOWN(shortCondition15) and MACDBearOn982
Open Long longBullMACross and MACDBullOn986
Close BearMACross and MACDBearOn988
Open Long longBullMAPlus and MACDBullOn991
Close BearMAPlus and MACDBearOn993
Open Long longmacdTPlOn996
Close macdTPsOn998
Open Long longmacdTPl or MACDBullOn1001
Close macdTPs or MACDBearOn1003
Open Long longMACDBullOn1006
Close MACDBearOn1008
Open Long longATRLCondition and MACDBullOn1011
Close ATRSCondition and MACDBearOn1013
Open Long longLongRepeat and MACDBullOn1016
Close ShortRepeat and MACDBearOn1018
Open Long longLongRepeat and MACDBull and L_ConsecutiveOn1021
Close ShortRepeat and MACDBear and S_ConsecutiveOn1023
Open Long longMACDBullOn1026
Exit Exit_LFX stopMACDBearOn1028
Open Long longnot na(close[lengthBO]) and BULLRSIOn1032
Close BEARRSIOn1034
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSIOn1037
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSIOn1039
Open Long long(longCondition15) and BULLRSIOn1042
Close 15m BREAK DOWN(shortCondition15) and BEARRSIOn1045
Open Long longBullMACross and BULLRSIOn1049
Close BearMACross and BEARRSIOn1051
Open Long longBullMAPlus and BULLRSIOn1054
Close BearMAPlus and BEARRSIOn1056
Open Long longmacdTPl and BULLRSIOn1059
Close macdTPs and BEARRSIOn1061
Open Long long(macdTPl and BULLRSI) or (MACDBull and BULLRSI)On1064
Close (macdTPs and BEARRSI) or (MACDBear and BEARRSI)On1066
Open Long long(MACDBull and BULLRSI)On1069
Close (MACDBear and BEARRSI)On1071
Open Long longATRLCondition and BULLRSIOn1074
Close ATRSCondition and BEARRSIOn1076
Open Long longLongRepeat and BULLRSIOn1079
Close ShortRepeat and BEARRSIOn1081
Open Long longLongRepeat and BULLRSI and L_ConsecutiveOn1084
Close ShortRepeat and BEARRSI and S_ConsecutiveOn1086
Open Long longBULLRSIOn1089
Exit Exit_LFX stopBEARRSIOn1091
Open Long longnot na(close[lengthBO]) and BullMAPlusOn1095
Close BearMAPlusOn1097
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlusOn1100
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlusOn1102
Open Long long(longCondition15) and BullMAPlusOn1105
Close 15m BREAK DOWN(shortCondition15) and BearMAPlusOn1108
Open Long longmacdTPl and BullMAPlusOn1112
Close macdTPs and BearMAPlusOn1114
Open Long long(macdTPl and BullMAPlus) or (MACDBull and BullMAPlus)On1117
Close (macdTPs and BearMAPlus) or (MACDBear and BearMAPlus)On1119
Open Long long(MACDBull and BullMAPlus)On1122
Close (MACDBear and BearMAPlus)On1124
Open Long longBullMACrossOn1127
Close BearMACrossOn1129
Open Long longBullMAPlusOn1132
Close BearMAPlusOn1134
Open Long longATRLCondition and BullMAPlusOn1137
Close ATRSCondition and BearMAPlusOn1139
Open Long longLongRepeat and BullMAPlusOn1142
Close ShortRepeat and BearMAPlusOn1144
Open Long longLongRepeat and BullMAPlus and L_ConsecutiveOn1147
Close ShortRepeat and BearMAPlus and S_ConsecutiveOn1149
Open Long longBullMAPlusOn1152
Exit Exit_LFX stopBearMAPlusOn1154
Open Long longnot na(close[lengthBO]) and ichi_bullplusOn1158
Close ichi_bearplusOn1160
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplusOn1163
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplusOn1165
Open Long long(longCondition15) and ichi_bullplusOn1168
Close 15m BREAK DOWN(shortCondition15) and ichi_bearplusOn1171
Open Long longBullMACross and ichi_bullplusOn1175
Close BearMACross and ichi_bearplusOn1177
Open Long longBullMAPlus and ichi_bullplusOn1180
Close BearMAPlus and ichi_bearplusOn1182
Open Long longmacdTPl and ichi_bullplusOn1185
Close macdTPs and ichi_bearplusOn1187
Open Long long(macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus)On1190
Close (macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus)On1192
Open Long long(MACDBull and ichi_bullplus)On1195
Close (MACDBear and ichi_bearplus)On1197
Open Long longATRLCondition and ichi_bullplusOn1200
Close ATRSCondition and ichi_bearplusOn1202
Open Long longLongRepeat and ichi_bullplusOn1205
Close ShortRepeat and ichi_bearplusOn1207
Open Long longLongRepeat and ichi_bullplus and L_ConsecutiveOn1210
Close ShortRepeat and ichi_bearplus and S_ConsecutiveOn1212
Open Long longichi_bullplusOn1215
Exit Exit_LFX stopichi_bearplusOn1217
Open Long longnot na(close[lengthBO]) and AroonHitUpOn1221
Close AroonHitDownOn1223
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUpOn1226
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDownOn1228
Open Long long(longCondition15) and AroonHitUpOn1231
Close 15m BREAK DOWN(shortCondition15) and AroonHitDownOn1234
Open Long longBullMACross and AroonHitUpOn1238
Close BearMACross and AroonHitDownOn1240
Open Long longBullMAPlus and AroonHitUpOn1243
Close BearMAPlus and AroonHitDownOn1245
Open Long longmacdTPl and AroonHitUpOn1248
Close macdTPs and AroonHitDownOn1250
Open Long long(macdTPl and AroonHitUp) or (MACDBull and AroonHitUp)On1253
Close (macdTPs and AroonHitDown) or (MACDBear and AroonHitDown)On1255
Open Long long(MACDBull and AroonHitUp)On1258
Close (MACDBear and AroonHitDown)On1260
Open Long longATRLCondition and AroonHitUpOn1263
Close ATRSCondition and AroonHitDownOn1265
Open Long longLongRepeat and AroonHitUpOn1268
Close ShortRepeat and AroonHitDownOn1270
Open Long longLongRepeat and AroonHitUp and L_ConsecutiveOn1273
Close ShortRepeat and AroonHitDown and S_ConsecutiveOn1275
Open Long longAroonHitUpOn1278
Exit Exit_LFX stopAroonHitDownOn1280
Open Long longnot na(close[lengthBO])On1284
Exit Long stopBreakOut_MODE == trueOn1285
Open Long long(Consecutive_MODE ? ups >= consecutiveBarsUp : na)On1288
Close (Consecutive_MODE ? dns >= consecutiveBarsDown : na)On1290
Open Long long(longCondition15)On1293
Close 15m BREAK DOWN(shortCondition15)On1296
Open Long longBullMACrossOn1300
Close BearMACrossOn1302
Open Long longBullMAPlusOn1305
Close BearMAPlusOn1307
Open Long longmacdTPlOn1310
Close macdTPsOn1312
Open Long longmacdTPl or MACDBullOn1315
Close macdTPs or MACDBearOn1317
Open Long longMACDBullOn1320
Close MACDBearOn1322
Open Long longATRLConditionOn1325
Close ATRSConditionOn1327
Open Long longLongRepeatOn1330
Close ShortRepeatOn1332
Open Long longLongRepeat and L_ConsecutiveOn1335
Close ShortRepeat and S_ConsecutiveOn1337
Open Long longForex_mode == trueOn1339
Exit Spot_ExitFX stopForex_mode == trueOn1340
Exit Exit stop and limitstrategy.position_size > 0On1390
Exit Exit stop and limitstrategy.position_size < 0On1392
Exit Exit stop and limitstrategy.position_size > 0On1395

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

Alerts

AlertCallMessageLine
(no title)alert15m BREAK UP604
(no title)alert15m BREAK DOWN607
(no title)alert15m BREAK UP667
(no title)alert15m BREAK DOWN670
(no title)alert15m BREAK UP730
(no title)alert15m BREAK DOWN733
(no title)alert15m BREAK UP793
(no title)alert15m BREAK DOWN796
(no title)alert15m BREAK UP856
(no title)alert15m BREAK DOWN859
(no title)alert15m BREAK UP918
(no title)alert15m BREAK DOWN921
(no title)alert15m BREAK UP980
(no title)alert15m BREAK DOWN983
(no title)alert15m BREAK UP1043
(no title)alert15m BREAK DOWN1046
(no title)alert15m BREAK UP1106
(no title)alert15m BREAK DOWN1109
(no title)alert15m BREAK UP1169
(no title)alert15m BREAK DOWN1172
(no title)alert15m BREAK UP1232
(no title)alert15m BREAK DOWN1235
(no title)alert15m BREAK UP1294
(no title)alert15m BREAK DOWN1297

Does it repaint?

No

No repainting patterns in the source.

The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.

  • ClearHigher-timeframe data1 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.

Similar scripts

Indicators and strategies built from the same calculations.

ScriptSharesTypeNetTradesMax drawdown
HAERI 𝐍𝐄𝐓𝐖𝐎𝐑𝐊 by ahhaneginema wma rsi pivotlow pivothigh sma highest lowest stdev atr rma highestbars lowestbarsv4 strategydoes not run in Zeal Terminal
Multi MA Trend Following Strategy Template by TradeAutomationema hma rma sma vwma wma stdev atr highest lowestv5 strategy+12.3%326.9%
TICK Scalping strategy, SPY 1 min by PtGamblerrma ema wma sma pivotlow pivothigh rsi lowest highestv5 strategyNo trades on this market
Multi Trend Cross Strategy Template by TradeAutomationema hma rma sma vwma wma stdev highest lowestv5 strategy+33.0%37.3%
VuManChu Cipher B + Divergences Strategy by nattichai001ema cross lowest highest rsi sma rma wmav4 strategy+76.6%17518.4%

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.

  • 14 settings use the untyped input() (line 115, 286, 293, 295, 402, 403, 404, 405, 406, 407, 411, 457, 458, 459). 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.

Clean v5

Not verified

The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L1397:C0: no source was supplied for the library 'X4815162342/X48_LibaryStrategyStatus/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked.

  • Line 286: input() → input.source()
  • Line 293: input() → input.int()
  • Line 295: input() → input.int()
  • Line 402: input() → input.int()
  • Line 403: input() → input.float()
  • Line 404: input() → input.int()
7 more edits
  • Line 405: input() → input.float()
  • Line 406: input() → input.int()
  • Line 407: input() → input.float()
  • Line 411: input() → input.int()
  • Line 457: input() → input.int()
  • Line 458: input() → input.int()
  • Line 459: input() → input.int()
⋯/////////// Normal Setting ////////////////-srcstrategy = input(close, title='💯4️⃣ Source Multi MA', group = GRMAC, tooltip = 'Normal Line = Close \nSmooth Line = ohlc4')+srcstrategy = input.source(close, title='💯4️⃣ Source Multi MA', group = GRMAC, tooltip = 'Normal Line = Close \nSmooth Line = ohlc4')///////////// EMA/SMA SETTING /////////////⋯slowcolor = input.color(color.new(color.yellow,0), group = GRMAC, inline = '110', title = 'Slow MA Color')-ma1strategy = input(12, title='💯4️⃣ Fast MA Length', group = GRMAC, inline = '12')+ma1strategy = input.int(12, title='💯4️⃣ Fast MA Length', group = GRMAC, inline = '12')type1strategy = input.string('EMA', 'Fast MA Type', options=['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'], group = GRMAC, tooltip = 'SMA / EMA / WMA / HMA / RMA / VWMA', inline = '12')-ma3strategy = input(26, title='💯4️⃣ Slow MA Length', group = GRMAC, inline = '13')+ma3strategy = input.int(26, title='💯4️⃣ Slow MA Length', group = GRMAC, inline = '13')type3strategy = input.string('EMA', 'Slow MA Type', options=['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'], group = GRMAC, tooltip = 'SMA / EMA / WMA / HMA / RMA / VWMA', inline = '13')⋯Ichi_Mode = input.bool(title="ICHIMOKU PLOT MODE", defval=false, group = GRIC)-tenkan_len  = input(9,'💮 Tenkan          ',inline='tenkan', group = GRIC, tooltip = 'TENKAN = FAST SIGNAL')+tenkan_len  = input.int(9,'💮 Tenkan          ',inline='tenkan', group = GRIC, tooltip = 'TENKAN = FAST SIGNAL')-tenkan_mult = input(2.,'',inline='tenkan', group = GRIC)+tenkan_mult = input.float(2.,'',inline='tenkan', group = GRIC)-kijun_len   = input(26,'💮 Kijun             ',inline='kijun', group = GRIC, tooltip = 'KIJUN = SLOW SIGNAL')+kijun_len   = input.int(26,'💮 Kijun             ',inline='kijun', group = GRIC, tooltip = 'KIJUN = SLOW SIGNAL')-kijun_mult  = input(4.,'',inline='kijun', group = GRIC)+kijun_mult  = input.float(4.,'',inline='kijun', group = GRIC)-spanB_len   = input(52,'Senkou Span A/B ',inline='span', group = GRIC, tooltip = 'SENKOU = CLOUD SIGNAL')+spanB_len   = input.int(52,'Senkou Span A/B ',inline='span', group = GRIC, tooltip = 'SENKOU = CLOUD SIGNAL')-spanB_mult  = input(6.,'',inline='span', group = GRIC)+spanB_mult  = input.float(6.,'',inline='span', group = GRIC)cloudacolor = input.color(defval = color.new(color.orange,20), title = 'CLOUD-A', inline='span1', group = GRIC)⋯chi_color = input.color(defval = color.new(#73ecff,0), title = "Chikou-Color", group = GRIC, inline = 'CHIKOU')-offset      = input(26,'Chikou', group = GRIC, tooltip = 'CHIKOU = CANDLE LOOK BACK DEFAULT = 26', inline = 'CHIKOU')+offset      = input.int(26,'Chikou', group = GRIC, tooltip = 'CHIKOU = CANDLE LOOK BACK DEFAULT = 26', inline = 'CHIKOU')//------------------------------------------------------------------------------⋯//if MACD_MODE_SIG == true-MACDfastLength = input(12, title='🅰️5️⃣ MACD Fast', group = GRCMA, inline = 'MACDSIG1')+MACDfastLength = input.int(12, title='🅰️5️⃣ MACD Fast', group = GRCMA, inline = 'MACDSIG1')-MACDslowlength = input(26, title='🅰️5️⃣ MACD Slow', group = GRCMA, inline = 'MACDSIG1')+MACDslowlength = input.int(26, title='🅰️5️⃣ MACD Slow', group = GRCMA, inline = 'MACDSIG1')-MACDLength = input(18, title='🅰️5️⃣ MACD Length', group = GRCMA)+MACDLength = input.int(18, title='🅰️5️⃣ MACD Length', group = GRCMA)macdupcolor = input.color(defval = color.new(color.green,0), title = 'CROSS-UP', inline = 'MACDCO', group = GRCMA)⋯

Does it run in Pine Script v6?

Not tested

The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L1397:C0: no source was supplied for the library 'X4815162342/X48_LibaryStrategyStatus/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// Commission = 0.1 or 0.04-//@version=5+//@version=6strategy("X48 - Strategy | Channel BreakOut & Consecutive (17in1) + TL/TP/SL | V.2.10", overlay=true, calc_on_order_fills = true, initial_capital = 500,default_qty_type = strategy.percent_of_equity, default_qty_value = 5, commission_type = strategy.commission.percent, commission_value = 0.1, currency = currency.USDT, slippage = 1)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2No It imports the library X4815162342/X48_LibaryStrategyStatus/2, whose source is not available here, so it does not run hereNot measured
PineTSNot testedNot testedNot measured

“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/// © X4815162342//================== Read This First Before Use This Strategy ==============// *********** Please be aware that this strategy is not a guarantee of success and may lead to losses.// *********** Trading involves risk and you should always do your own research before making any decisions.// ================= Thanks Source Script and Explain This Strategy ===================// This Strategy Are Combine [5] Strategy and [8] Indicators [1] Alert Function For Systematric Trading User.// [3] Strategy List, Thanks For Original Source Script [1],[2] From Tradingview Build-in Script [3] From fmzquant Github// [3.1] Channel BreakOut Strategy : Calculate BreakOut Zone For Buy and Sell.// [3.2] Consecutive Bars UP/Down Strategy : The consecutive bars up/down strategy is a trading strategy used to identify potential buy and sell signals in the stock market. This strategy involves looking for a series of bars (or candles) that are either all increasing or all decreasing in price. If the bars are all increasing, it can be a signal to buy, and if the bars are all decreasing, it can be a signal to sell. This strategy can be used on any timeframe, from a daily chart to an intraday chart.// [3.3] 15m Range Length SD : Range Of High and Low Candle Price and Lookback For Calculate Buy and Sell.// [3.4] MA Type CrossOver and CrossUnder// [3.5] MACD CrossOver and CrossUnder// [8] Indicators Are Simple Source Script (Almost I'm Chating With CHAT-GPT and Convert pinescript V4 to V5 again for complete almost script and combine after)// [8.1] SwingHigh and SwingLow Plot For SL (StopLoss by Last Swing).// [8.2] Engulfing and 3 Candle Engulfing Plot.// [8.3] Stochastic RSI for Plot and Fill Background Paint and Plot TEXT For BULL and BEAR TREND.// [8.4] MA TYPE MODE are plot 2 line of MA Type (EMA, SMA, HMA, WMA, VWMA) for Crossover and Crossunder.// [8.5] Donchian Fans MODE are Plot Dot Line With Triangle Degree Bull Trend is Green Plot and Bear Trend is Red Plot.// [8.6] Ichimoku Cloud Are Plot Cloud A-B For Bull and Bear Trend.// [8.7] RSI OB and OS for TEXT PLOT 'OB' , 'OS' you will know after OB and OS, you can combo with other indicators that's make you know what's the similar trend look like?// [8.8] MACD for Plot Diamond when MACD > 0 and MACD < 0, you can combo with other indicators that's make you know what's the similar trend look like?// [1] Alert Can Alert Sent When Buy and Sell or TP and SL, you can adjust text to alert sent by your self or use default setting.// ========== Let'e Me Explain How To Use This Strategy =============// ========== Properties Setting ==========// Capital : Default : 500 USDT For Alot Of People Are Beginner Investor = It's Capital Your Cash For Invertment// Ordersize : Default Are Setting 5% / Order [It's Mean 5% From 1,000] We Call Compounded// ========== INPUT Setting ==========// First Part Use Must Choose Checkbox For Use [1] of [3] Strategy and Choose TP/SL by Swing or % (can chosoe both)// In Detail Of Setting Are Not Too Much, Please Read The Header Of Setting Before Change The Value// For The Indicator In List You Want To Add Just Check ✅ From MODE Setting, It's Show On Your Chart// You Can Custom TP/SL % You Want// ========== ##### No trading strategy is guaranteed to be 100% successful. ###### =========// For Example In My Systematic Trading// Select 1/3 Strategy Setting TP/SL % Match With Timeframe TP Long Are Not Set It's Can 161.8 - 423.6% but Short Position Are Not Than 100% Just Fine From Your Aset// Choose Indicators For Make Sure Trend and Strategy are the same way like Strategy are Long Position but MACD and Sto background is bear. that's mean this time not open position.// Donchian Fans is Simple Support and Ressistant If You Don't Know How To Plot That's, This indicator plot a simple for you ><.// Make Sure With Engulfing and 3 Candle Engulfing If You Don't Know, What's The Engulfing, This Indicator are plot for you too ><.// For a Big Trend You can use Ichimoku Cloud For Check Trend, Candle Upper Than Cloud or Lower Than Cloud for Bull and Bear Trend.  /////////notes////////////////////////////////////////// This is based on the ATR trailing stop indicator //// width addition of two levels of stops and        //// different interpretation.                        //// This is a fast-reacting system and is better     //// suited for higher volatility markets             ////////////////////////////////////////////////////////// ========== Confirm Setting ==========// 1. Confirm by MACD > 0 and < 0// 2. Confirm by Stochastic RSI Cross// 3. Confirm by MA Type Fast > Slow or <// 4. Confirm by Ichimoku Tenkan > Kijun or <// ========== TP/SL Setting ==========// 1. By Swing High / Low// 2. By ATR Trailing Stop// 3. By Callback [%] From Last H/L// 4. By FIX [%] TP/SL// For Forex Setting (For Free Swap And Commission 0 Only)// Capital = 50$// Order Size = 1 Contract// Commission = 0// Slippage = Average Your Spread Broker// TP = 0.0055% - 0.0057% (For Forex Use Lot For Easy TP by PNL 7-11 pip)// For Cryptocurrency Setting// Capital = 100$// Order Size = 16.333 USDT// Commission = 0.1 or 0.04//@version=5strategy("X48 - Strategy | Channel BreakOut & Consecutive (17in1) + TL/TP/SL | V.2.10", overlay=true, calc_on_order_fills = true, initial_capital = 500,default_qty_type = strategy.percent_of_equity, default_qty_value = 5, commission_type = strategy.commission.percent, commission_value = 0.1, currency = currency.USDT, slippage = 1)//================ SPOT MODE ==============GRSPT = "=== 🍀🍀🍀 SPOT MODE 🍀🍀🍀 ==="Spot_MODE = input.bool(defval = false, title = "🍀 SPOT MODE", group = GRSPT)//================ CHANNEL BREAKOUT SETTING ===============GRS = "==1️⃣2️⃣3️⃣4️⃣5️⃣ SELECT [X] STRATEGY + TAKE PROFIT & STOP LOSS ? + CONFIRM MODE ? 5️⃣4️⃣3️⃣2️⃣1️⃣=="GR1 = "===== 1️⃣1️⃣1️⃣ CHANNEL BREAKOUT STRATEGY 1️⃣1️⃣1️⃣====="BreakOut_MODE = input.bool(defval = true, title = "1️⃣ CHANNEL BREAKOUT MODE", group = GRS, inline = "MainHEAD", tooltip = "Use Channel BreakOut Strategy")GRCON = "=====🅰️🅱️ CONFIRM MODE 🅱️🅰️====="MACDConfirm_MODE = input.bool(defval = false, title = "🅰️ MACD CONFIRM MODE", group = GRCON, tooltip = "Use MACD For Confirm Signal")//StoConfirm_MODE = input.bool(defval = false, title = "🅱️ STOCHASTIC CONFIRM MODE", group = GRCON, tooltip = "Use Stochastic For Confirm Signal")RSIConfirm_MODE = input.bool(defval = false, title = "🉐 RSI CONFIRM MODE", group = GRCON, tooltip = "Use Stochastic For Confirm Signal")MACross_MODE = input.bool(defval = false, title = "💯 MA CROSS X CONFIRM MODE", group = GRCON, tooltip = "Use MA Type Cross For Confirm Signal")IchiConfirm_MODE = input.bool(defval = false, title = "💮 ICHIMOKU TENKAN&KIJUN CROSS X CONFIRM MODE", group = GRCON, tooltip = "Use Ichimoku Tenkan & Kijun Cross For Confirm Signal")GRSUB = "=====🆎🆑🅾️🆘 TP & SL SELECT MODE 🆘🅾️🆑🆎====="Swing_STOP = input.bool(title="🆎 STOP LOSS BY SWING MODE", defval=false, group = GRSUB, tooltip = 'If Mode On = Use Stop Loss By Last Swing', inline = "SubMAIN")plotcolor = input.bool(defval = false, title = '🆑 ATR Trailing Stop', group = GRSUB)BOTrail_MODE = input.bool(defval = false, title = "🅾️ CALLBACK Trailing Stop [Low Profit But More TP]", group = GRSUB, tooltip = "BreakOut Length For Who's Want Fast Trailing But This Low Profit But More Time For TP\nIt's Can Combo With Breakout and 15m")GRATR = "⭐⭐ Volty Forex & Adaptive ATR Volume Setting ⭐⭐"Forex_mode = input.bool(defval = false, title = "💵💕 Volty Forex Mode Only & Commission = 0 Only", tooltip = "Forex Mode & Commission = 0 Only & Intitial Cap = 10,000 & Order Size = 100%", group = GRATR)volty_mode = input.bool(defval = false, title = "⭐ Adaptive ATR Volty MODE For CryptoCurrency", tooltip = "For Forex LotPump Commission = 0, Crypto Commission = 0.1", group = GRATR)Repeat_mode = input.bool(defval = false, title = "📌 Repeat Signal After TP/SL ❌ Can't Use With Confirm MODE ❌", tooltip = "Repeat New Position After TP and SL", group = GRATR)volty_conse = input.bool(defval = false, title = "🎯 Consecutive Bars Filter For Repeat Signal", tooltip = "Consecutive Bars Filter For Signal Repeat New Position After TP and SL", group = GRATR)length = input.int(defval = 5, title = "Adaptive ATR Candle Length", minval = 1, group = GRATR)numATRs = input.float(defval = 0.75, title = "Adaptive ATR Multiply", minval = 0.1, group = GRATR)FastEMATR = input.int(defval = 8, title = "FAST Adaptive ATR LINE - After Calculate", minval = 1, group = GRATR)SlowEMATR = input.int(defval = 32, title = "SLOW Adaptive ATR LINE - After Calculate", minval = 1, group = GRATR)atrs = ta.sma(ta.tr, length)*numATRsbuycon = close+atrssellcon = close-atrsnewcon = (buycon - sellcon) + closebuysig = ta.ema(buycon, 12)sellsig = ta.ema(sellcon, 12)newsig = ta.ema(newcon, FastEMATR)newsig2 = ta.ema(newcon, SlowEMATR)ATRLCondition = ta.crossover(newsig, newsig2)ATRSCondition = ta.crossunder(newsig, newsig2)L_Consecutive = close > close[1] and close[1] > close[2] and close[2] > close[3]S_Consecutive = close < close[1] and close[1] < close[2] and close[2] < close[3]LongRepeat = newsig > newsig2ShortRepeat = newsig < newsig2plot(volty_mode ? newsig : na, "newsig", color = color.white, linewidth = 1, style = plot.style_line)plot(volty_mode ? newsig2 : na, "newsig2", color = color.blue, linewidth = 1, style = plot.style_line)plotshape(volty_mode ? ATRLCondition : na, title = "LongSig", style = shape.labelup, location = location.belowbar, color = color.lime, text = "Buy", textcolor = color.blue)plotshape(volty_mode ? ATRSCondition : na, title = "ShortSig", style = shape.labeldown, location = location.abovebar, color = color.red, text = "Sell")/////////////////////////////////////////////////////////////////////////////////////////////////////Text_Alert_Future = '{{strategy.order.alert_message}}'copy_Fu = input( defval= Text_Alert_Future ,    title="Alert Message for BOT", inline = '00'  ,group = '═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It' ,tooltip = 'Alert For X48-BOT > Copy and Paste To Alert Function')passphrase = input.string(defval='1234', title ='Bot Pass',group='═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It', tooltip = 'Passphrase Must Be Same as X48-BOT')leveragex  = input.int(125,title='leverage',group='═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It',tooltip='"NOTHING" to do with Position size For Command To X48-BOT Only',minval=1)longcommand = input.string(defval='AutoLong', title = 'Bot Long Command',group='═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It', tooltip = '1.OpenLong\n2.AutoLong\n***If AutoLong = Close(100%) First > Open Long Position Auto')shortcommand = input.string(defval='AutoShort', title = 'Bot Short Command',group='═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It', tooltip = '1.OpenShort\n2.AutoShort\n***If AutoShort = Close(100%) First > Open Short Position Auto')markettype = input.string(defval='bnfuture', title = 'Future/Spot Command',group='═ Bot Setting ═ \n >> If You Dont Use Bot Just Pass It', tooltip = '1. bnfuture = FUTURE MODE\n2. bnspot = SPOT MODE\n 3.bncombo = EZ 2in1 Order')//////////////// Strategy Alert For X4815162342 BOT ////////////////////////////// For Use Bot Can Change This Command By Your Self /////////////////////string Alert_OpenLong       = '{"ex":"'+markettype+'","side": "'+longcommand+'", "amount": "@{{strategy.order.contracts}}", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'", "tp" : "25", "sl" : "0", "tl" : "0", "callback" : "0"}'string Alert_OpenShort      = '{"ex":"'+markettype+'","side": "'+shortcommand+'", "amount": "@{{strategy.order.contracts}}", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'", "tp" : "25", "sl" : "0", "tl" : "0", "callback" : "0"}'//string Alert_LongTP         = '{"ex":"bnfuture","side": "CloseLong", "amount": "@{{strategy.order.contracts}}", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'"}'//string Alert_ShortTP        = '{"ex":"bnfuture","side": "CloseShort", "amount": "@{{strategy.order.contracts}}", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'"}'//var message_closelong       = '{"ex":"bnfuture","side": "CloseLong", "amount": "%100", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'"}'//var message_closeshort      = '{"ex":"bnfuture","side": "CloseShort", "amount": "%100", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'"}'string Alert_StopLosslong   = '{"ex":"'+markettype+'","side": "CloseLong", "amount": "%100", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'", "tp" : "0", "sl" : "0", "tl" : "0", "callback" : "0"}'string Alert_StopLossshort  = '{"ex":"'+markettype+'","side": "CloseShort", "amount": "%100", "symbol": "{{ticker}}", "passphrase": "'+passphrase+'","leverage":"'+str.tostring(leveragex)+'", "tp" : "0", "sl" : "0", "tl" : "0", "callback" : "0"}'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  PLOTBO_MODE = input.bool(title="[PLOT] BreakOut LINE [PLOT]", defval = false, group = GR1)lengthBO = input.int(title="1️⃣ Length BreakOut", minval=1, maxval=1000, defval=5, group = GR1)triling_BO = input.float(title = "🅾️ BreakOut Trailing CALLBACK [%]", defval = 25, minval = 0.01, maxval = 999.99, group = GR1, tooltip = "Binance Callback = 5%, Now You Can Customize Your Callback ><")upBound = ta.highest(high, lengthBO)downBound = ta.lowest(low, lengthBO)SL_LongBO = (close < (upBound-((upBound*triling_BO)/100)))SL_ShortBO = (close > (downBound+((downBound*triling_BO)/100)))pvthi_BO = upBoundpvtlo_BO = downBoundShuntBO = 1  //Wait for close before printing pivot? 1 for true 0 for flasemaxLvlLenBO = 0  //Maximum Extension LengthpvthiBO = pvthi_BO[ShuntBO]pvtloBO = pvtlo_BO[ShuntBO]// Count How many candles for current Pivot Level, If new reset.counthiBO = ta.barssince(not na(pvthiBO))countloBO = ta.barssince(not na(pvtloBO))pvthisBO = fixnan(pvthiBO)pvtlosBO = fixnan(pvtloBO)hipcBO = ta.change(pvthisBO) != 0 ? na : color.limelopcBO = ta.change(pvtlosBO) != 0 ? na : color.red// Display Pivot linesplot(PLOTBO_MODE ? maxLvlLenBO == 0 or counthiBO < maxLvlLenBO ? pvthisBO : na : na, color=hipcBO, linewidth=2, title='Top LevelsBO')plot(PLOTBO_MODE ? maxLvlLenBO == 0 or countloBO < maxLvlLenBO ? pvtlosBO : na : na, color=lopcBO, linewidth=2, title='Bottom LevelsBO')if BOTrail_MODE == true    if Spot_MODE == false        if SL_LongBO and strategy.position_size > 0            strategy.close("Long", qty_percent = 100, comment = "❇️CALLBACK❇️")        if SL_ShortBO and strategy.position_size < 0            strategy.close("Short", qty_percent = 100, comment = "❇️CALLBACK❇️")    if Spot_MODE == true        if SL_LongBO and strategy.position_size > 0            strategy.close("Long", qty_percent = 100, comment = "❇️CALLBACK❇️")//================ Consecutive UP/Down ===============GR2 = "=====2️⃣2️⃣2️⃣ Consecutive Up/Down Strategy 2️⃣2️⃣2️⃣====="Consecutive_MODE = input.bool(defval = false, title = "2️⃣ CONSECUTIVE BarsUP/DOWN MODE", group = GRS, tooltip = "Use Consecutive Strategy")consecutiveBarsUp = input.int(defval = 3, title = '2️⃣ Consecutive BarsUp', minval = 1, group = GR2)consecutiveBarsDown = input.int(defval = 3, title = '2️⃣ Consecutive BarsDown', minval = 1, group = GR2)price = closeups = 0.0ups := price > price[1] ? nz(ups[1]) + 1 : 0dns = 0.0dns := price < price[1] ? nz(dns[1]) + 1 : 0// ============= 15m BREAK RANGE GOLD AND CRYPTO ===============GR3 = "=====3️⃣3️⃣3️⃣ 15m BREAK RANGE STRATEGY 3️⃣3️⃣3️⃣====="hlrang_mode = input.bool(defval = false, title = "3️⃣ 15m High/Low Range Break MODE [BUY ONLY]", group = GRS)hlrang_plot = input.bool(defval = false, title = "[PLOT] 15m High/Low Range Break [PLOT]", group = GR3)rrange = high-lowlookback = input.int(2, minval=1, title="3️⃣ 15m - Lookback", group = GR3)xr = input.int(10, minval=1, title="3️⃣ 15m - Range Length", group = GR3)mult = input.float(2.0, minval=0.001, maxval=50, title="15m - SD", group = GR3)computation = mult * ta.stdev(rrange, xr) + ta.sma(rrange, xr)cond1 = rrange > computationplot(hlrang_plot ? rrange : na, title="Range H-L", style=plot.style_columns)plot(hlrang_plot ? computation : na, title="H-L SD", style=plot.style_line, color=color.orange)plot(hlrang_plot ? close - close[lookback] : na, title="Close Direction", color=close > close[lookback] ? color.green : color.red, style=plot.style_histogram)longCondition15 =  hlrang_mode ? cond1 and close > close[lookback] : nashortCondition15 = hlrang_mode ? cond1 and close < close[lookback] : na//============== Swing High and Low Mode ===============// Swing Plot//Swing_MODE = input.bool(title="PLOT SWING MODE", defval=true, group = '= SWING SETTING =', tooltip = 'If Mode On = Plot Swing High and Swing Low')pvtLenL = input.int(3, minval=1, title='🆎 Pivot Length Left Hand Side', group = '==🆎🆎🆎 TP/SL SWING SETTING 🆎🆎🆎==')pvtLenR = input.int(3, minval=1, title='🆎 Pivot Length Right Hand Side', group = '==🆎🆎🆎 TP/SL SWING SETTING 🆎🆎🆎==')// Get High and Low Pivot Pointspvthi_ = ta.pivothigh(high, pvtLenL, pvtLenR)pvtlo_ = ta.pivotlow(low, pvtLenL, pvtLenR)// Force Pivot completion before plotting.Shunt = 1  //Wait for close before printing pivot? 1 for true 0 for flasemaxLvlLen = 0  //Maximum Extension Lengthpvthi = pvthi_[Shunt]pvtlo = pvtlo_[Shunt]// Count How many candles for current Pivot Level, If new reset.counthi = ta.barssince(not na(pvthi))countlo = ta.barssince(not na(pvtlo))pvthis = fixnan(pvthi)pvtlos = fixnan(pvtlo)hipc = ta.change(pvthis) != 0 ? na : color.maroonlopc = ta.change(pvtlos) != 0 ? na : color.green// Display Pivot linesplot(Swing_STOP ? maxLvlLen == 0 or counthi < maxLvlLen ? pvthis : na : na, color=hipc, linewidth=1, offset=-pvtLenR - Shunt, title='Top Levels')plot(Swing_STOP ? maxLvlLen == 0 or countlo < maxLvlLen ? pvtlos : na : na, color=lopc, linewidth=1, offset=-pvtLenR - Shunt, title='Bottom Levels')plot(Swing_STOP ? maxLvlLen == 0 or counthi < maxLvlLen ? pvthis : na : na, color=hipc, linewidth=1, offset=0, title='Top Levels 2')plot(Swing_STOP ? maxLvlLen == 0 or countlo < maxLvlLen ? pvtlos : na : na, color=lopc, linewidth=1, offset=0, title='Bottom Levels 2')stopswinglow = ta.crossunder(close,pvtlos)stopswinghigh = ta.crossover(close,pvthis)if Swing_STOP == true    if Spot_MODE == false        if (close < pvtlos)            strategy.close("Long", qty_percent = 100, comment = "StopLong🏳️SwLow", alert_message = Alert_StopLosslong)        if (close > pvthis)            strategy.close("Short", qty_percent = 100, comment = "StopShort🏳️SwHi", alert_message = Alert_StopLossshort)    if Spot_MODE == true        if (close < pvtlos)            strategy.close("Long", qty_percent = 100, comment = "StopLong🏳️SwLow", alert_message = Alert_StopLosslong)engulfing_mode = input.bool(title="Normal Engulfing Signal", defval=false, group="== ENGULFING SIGNAL ==", inline = '9')threeengulfing_mode = input.bool(title="3 Candle Engulfing Signal", defval=false, group="== ENGULFING SIGNAL ==", inline = '9')// bullish engulfing (Bueng)Bueng = open[3] > close[3] and open[2] > close[2] and open[1] > close[1] and close > open and (close >= open[1] or close[1] >= open) and close - open > open[1] - close[1]plotshape(threeengulfing_mode ? Bueng : na, style=shape.diamond, location=location.belowbar, color=color.new(#00e926,0), size=size.small, text = "3Engulfing", textcolor = color.new(#4eff64,0))// bearish engulfing (Beeng)Beeng = open[3] < close[3] and open[2] < close[2] and close[1] > open[1] and open > close and (open >= close[1] or open[1] >= close) and open - close > close[1] - open[1]plotshape(threeengulfing_mode ? Beeng : na, style=shape.diamond, location=location.abovebar, color=color.new(#ff571b,0), size=size.small, text = "3Engulfing", textcolor = color.new(#ff5a9b,0))// bullish engulfing (Bueng)Bueng2 = open[3] > close[3] ? open[2] > close[2] ? open[1] > close[1] ? close > open ? close >= open[1] ? close[1] >= open ? close - open > open[1] - close[1] ? color.blue : na : na : na : na : na : na : nabarcolor(threeengulfing_mode ? Bueng2 : na)// bearish engulfing (Beeng)Beeng2 = open[3] < close[3] ? open[2] < close[2] ? close[1] > open[1] ? open > close ? open >= close[1] ? open[1] >= close ? open - close > close[1] - open[1] ? color.white : na : na : na : na : na : na : nabarcolor(threeengulfing_mode ? Beeng2 : na)/////////////////////////////////////////////////////////////////////////////////////GRSTO = "==🅱️🅱️🅱️ STOCHASTIC RSI SETTING [BG/Confirm]🅱️🅱️🅱️=="//stobg_mode = input.bool(title="Stochastic RSI Background Paint", defval=false, group=GRSTO)//stobg_plot = input.bool(title="STO-TEXT", defval=false, group=GRSTO, inline = 'STOT1')//stobull_text = input.color(title = 'BULL', defval = color.white, group = GRSTO, inline = 'STOT1')//stobear_text = input.color(title = 'BEAR', defval = color.orange, group = GRSTO, inline = 'STOT1')//lengthMACD = input(title='🅱️ Length', defval=21, group = GRSTO, inline = '15')//offsetMACD = input(title='🅱️ Offset', defval=0, group = GRSTO, inline = '15')//srcMACD = input(close, title='🅱️ Source', group = GRSTO, inline = '16')//length2MACD = input(title='🅱️ Trigger Length', defval=6, group = GRSTO, inline = '16')//bullstobg = input.color(title = 'Bull BG Color', defval = color.green, group = GRSTO, inline = 'STOBG1')//bearstobg = input.color(title = 'Bear BG Color', defval = color.red, group = GRSTO, inline = 'STOBG1')//transstobg = input.int(defval = 75, title = 'Trans', minval = 0, maxval = 100, group = GRSTO, inline = 'STOBG1')////lsma = ta.linreg(srcMACD, lengthMACD, offsetMACD)//lsma2 = ta.linreg(lsma, lengthMACD, offsetMACD)//b = lsma - lsma2//zlsma2 = lsma + b//trig2 = ta.sma(zlsma2, length2MACD)////c1 = zlsma2 > trig2 ? bullstobg : bearstobg//stobull = ta.crossover(zlsma2,trig2)//stobear = ta.crossunder(zlsma2, trig2)//stobullplus = zlsma2 > trig2//stobearplus = zlsma2 < trig2//plotshape(stobg_plot ? stobull : na, title = 'STO-BULL', text = 'STO-BULL', location = location.belowbar, textcolor = stobull_text, size = size.tiny)//plotshape(stobg_plot ? stobear : na, title = 'STO-BULL', text = 'STO-BEAR', location = location.abovebar, textcolor = stobear_text, size = size.tiny)////p1 = plot(stobg_mode ? zlsma2 : na, color=c1, linewidth=0)//p2 = plot(stobg_mode ? trig2 : na, color=c1, linewidth=0)//fill(p1, p2, color=color.new(c1,transp = transstobg))// bullish engulfingbullishEngulfing = open[1] > close[1] ? close > open ? close >= open[1] ? close[1] >= open ? close - open > open[1] - close[1] ? color.purple : na : na : na : na : nabarcolor(engulfing_mode ? bullishEngulfing : na)// bearish engulfingbearishEngulfing = close[1] > open[1] ? open > close ? open >= close[1] ? open[1] >= close ? open - close > close[1] - open[1] ? color.yellow : na : na : na : na : nabarcolor(engulfing_mode ? bearishEngulfing : na)bullishEngulfing2 = (open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1])bearishEngulfing2 = (close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1])plotshape(engulfing_mode ? bullishEngulfing2 : na, style=shape.labelup, location=location.belowbar, color=color.yellow, size=size.auto, text = '↗️')plotshape(engulfing_mode ? bearishEngulfing2 : na, style=shape.labeldown, location=location.abovebar, color=color.white, size=size.auto, text = '↘️')////////////////////////////////////////////////////////////////////////////////////GRMAC = '===💯💯💯4️⃣ Multi MA SETTING 4️⃣💯💯💯==='MAStrategy_MODE = input.bool(title='4️⃣ MA CROSS X STRATEGY MODE', defval=false, group = GRS)MARepeat_Mode = input.bool(title='4️⃣ 🎯MA CROSS X REPEAT MODE', defval=false, group = GRS, tooltip = "Repeat Mode After TP/SL Open Position With Trend Fast >,< Slow Again")/////////// Normal Setting ////////////////srcstrategy = input(close, title='💯4️⃣ Source Multi MA', group = GRMAC, tooltip = 'Normal Line = Close \nSmooth Line = ohlc4')///////////// EMA/SMA SETTING /////////////pricestrategy = request.security(syminfo.tickerid, timeframe.period, srcstrategy)fastSW = input.bool(title='Show Fast MA Line', defval=false, group = GRMAC, inline = '11')fastcolor = input.color(color.new(color.red,0), group = GRMAC, inline = '110', title = 'Fast MA Color')slowSW = input.bool(title='Show Slow MA Line', defval=false, group = GRMAC, inline = '11')slowcolor = input.color(color.new(color.yellow,0), group = GRMAC, inline = '110', title = 'Slow MA Color')ma1strategy = input(12, title='💯4️⃣ Fast MA Length', group = GRMAC, inline = '12')type1strategy = input.string('EMA', 'Fast MA Type', options=['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'], group = GRMAC, tooltip = 'SMA / EMA / WMA / HMA / RMA / VWMA', inline = '12')ma3strategy = input(26, title='💯4️⃣ Slow MA Length', group = GRMAC, inline = '13')type3strategy = input.string('EMA', 'Slow MA Type', options=['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'], group = GRMAC, tooltip = 'SMA / EMA / WMA / HMA / RMA / VWMA', inline = '13')price1strategy = switch type1strategy    "EMA" => ta.ema(pricestrategy, ma1strategy)    "SMA" => ta.sma(pricestrategy, ma1strategy)    "WMA" => ta.wma(pricestrategy, ma1strategy)    "HMA" => ta.hma(pricestrategy, ma1strategy)    "RMA" => ta.rma(pricestrategy, ma1strategy)    "VWMA" => ta.vwma(pricestrategy, ma1strategy)        price3strategy = switch type3strategy    "EMA" => ta.ema(pricestrategy, ma3strategy)    "SMA" => ta.sma(pricestrategy, ma3strategy)    "WMA" => ta.wma(pricestrategy, ma3strategy)    "HMA" => ta.hma(pricestrategy, ma3strategy)    "RMA" => ta.rma(pricestrategy, ma3strategy)    "VWMA" => ta.vwma(pricestrategy, ma3strategy)FastL = plot(fastSW ? price1strategy : na, 'Fast MA', color=fastcolor, style = plot.style_line, linewidth=2)SlowL = plot(slowSW ? price3strategy : na, 'Slow MA', color=slowcolor, style = plot.style_line, linewidth=2)BullMACross = ta.crossover(price1strategy, price3strategy)BearMACross = ta.crossunder(price1strategy, price3strategy)BullMAPlus = price1strategy > price3strategyBearMAPlus = price1strategy < price3strategy//********* Background Paint ***********************prefillFast = plot(fastSW ? price1strategy : na, 'Fast MA', color=color.new(color.red, 100), style = plot.style_line, linewidth=2)prefillSlow = plot(slowSW ? price3strategy : na, 'Fast MA', color=color.new(color.yellow, 100), style = plot.style_line, linewidth=2)fcolor = price1strategy > price3strategy ? color.new(color.lime,70) : color.new(color.red,70)fill(prefillFast,prefillSlow, color=fcolor, title='BACKGROUND PAINT')// **********************************************// ==================== DONCHIAN FANS MODE =====================Donchian_MODE = input.bool(defval = false, title = "DONCHIAN FANS MODE", group = "== DONCHIAN FANS MODE ==")Donchian_Bollinger = input.bool(defval = false, title = "DONCHIAN BOLLINGER LINE", group = "== DONCHIAN FANS MODE ==")//  Initiate bars:var int bd = -1bd += 1//----------------------------------------------------------------------------------//  Required functions:f_highest_bar(_source, _bars, _length) =>    float _h_value = _source    int _h_bar = _bars    for _i = 0 to math.max(_length - 1, 0) by 1        bool _isSourceOver = _source[_i] > _h_value        if _isSourceOver            _h_value := _source[_i]            _h_bar := _bars[_i]            _h_bar    [_h_value, _h_bar]f_lowest_bar(_source, _bars, _length) =>    float _l_value = _source    int _l_bar = _bars    for _i = 0 to math.max(_length - 1, 0) by 1        bool _isSourceUnder = _source[_i] < _l_value        if _isSourceUnder            _l_value := _source[_i]            _l_bar := _bars[_i]            _l_bar    [_l_value, _l_bar]f_line(_x1, _y1, _r, _color) =>    var line _li = na    line.delete(id=_li)    _li := line.new(x1=_x1 - 1, y1=_y1 - _r, x2=_x1, y2=_y1, xloc=xloc.bar_index, extend=extend.right, color=_color, style=line.style_dashed, width=1)    _li//----------------------------------------------------------------------------------int FANSlength = input.int(defval=100, title='FANS length:', minval=1, group = "== DONCHIAN FANS MODE ==")[h_price, h_bar] = f_highest_bar(high, bd, FANSlength)[l_price, l_bar] = f_lowest_bar(low, bd, FANSlength)float mid = (h_price + l_price) / 2plot(Donchian_Bollinger ? h_price : na, title='H', color=color.new(color.white, 20), linewidth=1, style=plot.style_line)plot(Donchian_Bollinger ? mid : na, title='M', color=color.new(color.white, 20), linewidth=1, style=plot.style_line)plot(Donchian_Bollinger ? l_price : na, title='L', color=color.new(color.white, 20), linewidth=1, style=plot.style_line)var float r = ta.atr(FANSlength)if ta.change(mid) != 0    r := ta.atr(FANSlength)    rvar line h_1_04 = navar line h_1_08 = navar line h_1_16 = navar line h_1_32 = navar line h_1_64 = navar line l_1_04 = navar line l_1_08 = navar line l_1_16 = navar line l_1_32 = navar line l_1_64 = nabool is_new_h = h_price > h_price[1]bool is_new_l = l_price < l_price[1]vhb = ta.valuewhen(high >= h_price, h_bar, 0)vhp = ta.valuewhen(high >= h_price, h_price, 0)vlb = ta.valuewhen(low <= l_price, l_bar, 0)vlp = ta.valuewhen(low <= l_price, l_price, 0)if is_new_l and Donchian_MODE == true    h_1_04 := f_line(vhb, vhp, -r * (1. / 04.), color.red)    h_1_08 := f_line(vhb, vhp, -r * (1. / 08.), color.red)    h_1_16 := f_line(vhb, vhp, -r * (1. / 16.), color.red)    h_1_32 := f_line(vhb, vhp, -r * (1. / 32.), color.red)    h_1_64 := f_line(vhb, vhp, -r * (1. / 64.), color.red)    h_1_64if is_new_h and Donchian_MODE == true    l_1_04 := f_line(vlb, vlp, r * (1. / 04.), color.lime)    l_1_08 := f_line(vlb, vlp, r * (1. / 08.), color.lime)    l_1_16 := f_line(vlb, vlp, r * (1. / 16.), color.lime)    l_1_32 := f_line(vlb, vlp, r * (1. / 32.), color.lime)    l_1_64 := f_line(vlb, vlp, r * (1. / 64.), color.lime)    l_1_64// **********************************************GRIC = '===💮💮💮 ICHIMOKU SETTING 💮💮💮==='Ichi_Mode = input.bool(title="ICHIMOKU PLOT MODE", defval=false, group = GRIC)tenkan_len  = input(9,'💮 Tenkan          ',inline='tenkan', group = GRIC, tooltip = 'TENKAN = FAST SIGNAL')tenkan_mult = input(2.,'',inline='tenkan', group = GRIC)kijun_len   = input(26,'💮 Kijun             ',inline='kijun', group = GRIC, tooltip = 'KIJUN = SLOW SIGNAL')kijun_mult  = input(4.,'',inline='kijun', group = GRIC)spanB_len   = input(52,'Senkou Span A/B ',inline='span', group = GRIC, tooltip = 'SENKOU = CLOUD SIGNAL')spanB_mult  = input(6.,'',inline='span', group = GRIC)cloudacolor = input.color(defval = color.new(color.orange,20), title = 'CLOUD-A', inline='span1', group = GRIC)cloudbcolor = input.color(defval = color.new(color.purple,20), title = 'CLOUD-B', inline='span1', group = GRIC)chi_color = input.color(defval = color.new(#73ecff,0), title = "Chikou-Color", group = GRIC, inline = 'CHIKOU')offset      = input(26,'Chikou', group = GRIC, tooltip = 'CHIKOU = CANDLE LOOK BACK DEFAULT = 26', inline = 'CHIKOU')//------------------------------------------------------------------------------avg(src,length,mult)=>    atr = ta.atr(length)*mult    up = hl2 + atr    dn = hl2 - atr    upper = 0.,lower = 0.    upper := src[1] < upper[1] ? math.min(up,upper[1]) : up    lower := src[1] > lower[1] ? math.max(dn,lower[1]) : dn        os = 0,max = 0.,min = 0.    os := src > upper ? 1 : src < lower ? 0 : os[1]    spt = os == 1 ? lower : upper    max := ta.cross(src,spt) ? math.max(src,max[1]) : os == 1 ? math.max(src,max[1]) : spt    min := ta.cross(src,spt) ? math.min(src,min[1]) : os == 0 ? math.min(src,min[1]) : spt    math.avg(max,min)//------------------------------------------------------------------------------tenkan = avg(close,tenkan_len,tenkan_mult)kijun = avg(close,kijun_len,kijun_mult)senkouA = math.avg(kijun,tenkan)senkouB = avg(close,spanB_len,spanB_mult)//------------------------------------------------------------------------------tenkan_css = color.whitekijun_css = #ff5d00cloud_a = cloudacolorcloud_b = cloudbcolorchikou_css = color.new(#73ecff,20)plot(Ichi_Mode ? tenkan : na,'Tenkan-Sen',tenkan_css,style = plot.style_stepline, linewidth = 2)plot(Ichi_Mode ? kijun : na,'Kijun-Sen',kijun_css, style = plot.style_stepline, linewidth = 2)plot(Ichi_Mode ? ta.crossover(tenkan,kijun) ? kijun : na : na,'Crossover',#2157f3,3,plot.style_circles)plot(Ichi_Mode ? ta.crossunder(tenkan,kijun) ? kijun : na : na,'Crossunder',#ff5d00,3,plot.style_circles)A = plot(Ichi_Mode ? senkouA : na,'Senkou Span A',na,offset=offset-1)B = plot(Ichi_Mode ? senkouB : na,'Senkou Span B',na,offset=offset-1)fill(A,B,senkouA > senkouB ? cloud_a : cloud_b)ichi_bull = ta.crossover(tenkan,kijun)ichi_bear = ta.crossunder(tenkan,kijun)ichi_bullplus = tenkan > kijunichi_bearplus = tenkan < kijunplot(Ichi_Mode ? close : na,'Chikou',chi_color,offset=-offset+1, linewidth = 2)////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  GRCMA = '==🅰️🅰️5️⃣5️⃣ MACD SETTING [PLOT/Confirm]5️⃣5️⃣🅰️🅰️=='MACDStrategy_MODE = input.bool(title='5️⃣ MACD CROSS [0] STRATEGY MODE', defval=false, group = GRS)MACDStrategy_Repeat = input.bool(title='5️⃣🎯 MACD CROSS [0] REPEAT MODE', defval=false, group = GRS, tooltip = "Repeat Mode After TP/SL Open Position With Trend Fast >,< Slow Again")MACD_MODE_SIG= input.bool(title="MACD MODE = MACD Cross Signal", defval=false, group = GRCMA, tooltip = 'If Mode On = Use MACD Strategy for Signal When Cross Up and Cross Down')//if MACD_MODE_SIG == trueMACDfastLength = input(12, title='🅰️5️⃣ MACD Fast', group = GRCMA, inline = 'MACDSIG1')MACDslowlength = input(26, title='🅰️5️⃣ MACD Slow', group = GRCMA, inline = 'MACDSIG1')MACDLength = input(18, title='🅰️5️⃣ MACD Length', group = GRCMA)macdupcolor = input.color(defval = color.new(color.green,0), title = 'CROSS-UP', inline = 'MACDCO', group = GRCMA)macddowncolor = input.color(defval = color.new(color.red,0), title = 'CROSS-DOWN', inline = 'MACDCO', group = GRCMA)MACD = ta.ema(close, MACDfastLength) - ta.ema(close, MACDslowlength)aMACD = ta.ema(MACD, MACDLength)delta = MACD - aMACDmacdTPl = (ta.crossover(delta, 0))macdTPs = (ta.crossunder(delta, 0))MACDBull = delta > 0MACDBear = delta < 0plotshape(MACD_MODE_SIG ? macdTPl : na, title='macdTPl', text = '💎', color=macdupcolor, style=shape.circle, location=location.belowbar, size=size.auto)  //plot for buy iconplotshape(MACD_MODE_SIG ? macdTPs : na, title='macdTPs', text = '💎', color=macddowncolor, style=shape.circle, location=location.abovebar, size=size.auto)  //plot for buy icon//=============== TAKE PROFIT and STOP LOSS by % =================tpsl(percent) =>    strategy.position_avg_price * percent / 100 / syminfo.mintickGR4 = "=====🆘🆘🆘 TAKE PROFIT & STOP LOSS BY [%] 🆘🆘🆘====="mode= input.bool(title="🆘 Take Profit & Stop Loss By Percent (%)", defval=false, group=GRSUB, tooltip = "Take Profit & Stop Loss by % Change")tp_l = tpsl(input.float(99999, title='🆘 TP [LONG] %', group=GR4))tp_s = tpsl(input.float(33.3, title='🆘 TP [SHORT] %', group=GR4))sl = tpsl(input.float(0, title='🆘 Stop Loss %', group=GR4))calcStopLossPrice(OffsetPts) =>    if strategy.position_size > 0        strategy.position_avg_price - OffsetPts * syminfo.mintick    else if strategy.position_size < 0        strategy.position_avg_price + OffsetPts * syminfo.mintick    else        nacalcStopLossL_AlertPrice(OffsetPts) =>    strategy.position_avg_price - OffsetPts * syminfo.mintickcalcStopLossS_AlertPrice(OffsetPts) =>    strategy.position_avg_price + OffsetPts * syminfo.mintickcalcTakeProfitPrice(OffsetPts) =>    if strategy.position_size > 0        strategy.position_avg_price + OffsetPts * syminfo.mintick    else if strategy.position_size < 0        strategy.position_avg_price - OffsetPts * syminfo.mintick    else        nacalcTakeProfitL_AlertPrice(OffsetPts) =>    strategy.position_avg_price + OffsetPts * syminfo.mintickcalcTakeProfitS_AlertPrice(OffsetPts) =>    strategy.position_avg_price - OffsetPts * syminfo.mintickvar stoploss = 0.var stoploss_l = 0.var stoploss_s = 0.var takeprofit = 0.var takeprofit_l = 0.var takeprofit_s = 0.var takeprofit_ll = 0.var takeprofit_ss = 0.GRT = "=====🆑🆑🆑 ATR TRAILING STOP 🆑🆑🆑====="/////////notes////////////////////////////////////////// This is based on the ATR trailing stop indicator //// width addition of two levels of stops and        //// different interpretation.                        //// This is a fast-reacting system and is better     //// suited for higher volatility markets             //////////////////////////////////////////////////////// // Fast Trail //AP1 = input.int(5, '🆑 Fast ATR period', group = GRT)  // ATR PeriodAF1 = input.float(0.5, '🆑 Fast ATR multiplier', group = GRT)  // ATR FactorSL1 = AF1 * ta.atr(AP1)  // Stop LossTrail1 = 0.0iff_1 = close > nz(Trail1[1], 0) ? close - SL1 : close + SL1iff_2 = close < nz(Trail1[1], 0) and close[1] < nz(Trail1[1], 0) ? math.min(nz(Trail1[1], 0), close + SL1) : iff_1Trail1 := close > nz(Trail1[1], 0) and close[1] > nz(Trail1[1], 0) ? math.max(nz(Trail1[1], 0), close - SL1) : iff_2// Slow Trail //AP2 = input.int(10, '🆑 Slow ATR period', group = GRT)  // ATR PeriodAF2 = input.float(2, '🆑 Slow ATR multiplier', group = GRT)  // ATR FactorSL2 = AF2 * ta.atr(AP2)  // Stop LossTrail2 = 0.0iff_3 = close > nz(Trail2[1], 0) ? close - SL2 : close + SL2iff_4 = close < nz(Trail2[1], 0) and close[1] < nz(Trail2[1], 0) ? math.min(nz(Trail2[1], 0), close + SL2) : iff_3Trail2 := close > nz(Trail2[1], 0) and close[1] > nz(Trail2[1], 0) ? math.max(nz(Trail2[1], 0), close - SL2) : iff_4BuyLong = ta.crossover(Trail1, Trail2)SellShort = ta.crossunder(Trail1, Trail2)TS1 = plot(plotcolor ? Trail1 : na, 'Fast Trail', style=plot.style_line, color=Trail1 > Trail2 ? color.blue : color.yellow, linewidth=3, display=display.none)TS2 = plot(plotcolor ? Trail2 : na, 'Slow Trail', style=plot.style_line, color=Trail1 > Trail2 ? color.lime : color.blue, linewidth=3)if plotcolor == true    if BuyLong and strategy.position_size < 0        strategy.close('Short', qty_percent = 100, alert_message = Alert_StopLossshort, comment = "🚨ATR TL🚨")    if SellShort and strategy.position_size > 0        strategy.close('Long', qty_percent = 100, alert_message = Alert_StopLosslong, comment = "🚨ATR TL🚨")GRARO = "===🍩🍩🍩 AROON SETTING 🍩🍩🍩==="// ######### TRENDLOCK CONFIRM (MACD > 0 and MA FAST > SLOW) ########AroonConfirm_MODE = input.bool(defval = false, title = "🍩AROON 100% & -100% CONFIRM", group = GRCON)lengthAroon = input.int(14, minval=1, title = "AROON LENGTH", group = GRARO)AroonUpper = 100 * (ta.highestbars(high, lengthAroon) + lengthAroon)/lengthAroonAroonLower = 100 * (ta.lowestbars(low, lengthAroon) + lengthAroon)/lengthAroonAroonCrossUp = ta.crossover(AroonUpper, AroonLower)AroonCrossDown = ta.crossunder(AroonUpper, AroonLower)AroonHitUp = AroonUpper > AroonLowerAroonHitDown = AroonUpper < AroonLowerGRRSI = "🉐=== RSI MODE ==="RSI_PLOT = input.bool(defval = false, title = "🉐=== RSI LINE ===", group = GRRSI)RSI_OB = input.int(defval = 50, title = "🉐 RSI OverBought", minval = 1, maxval = 100, tooltip = "RSI OB", group = GRRSI)RSI_OS = input.int(defval = 50, title = "🉐 RSI OverSold", minval = 1, maxval = 100, tooltip = "RSI OS", group = GRRSI)RSI_LENGTH = input.int(defval = 14, title = "RSI LENGTH", minval = 1, maxval = 999, tooltip = "RSI LENGTH", group = GRRSI)RSI_SMA = input.int(defval = 50, title = "RSI SMA LENGTH", minval = 1, maxval = 999, tooltip = "RSI SMA LENGTH FOR PREDICT TREND", group = GRRSI)RSI_COL = input.color(defval = color.white, title = "RSI LINE", group = GRRSI, inline = "RSI1")RSI_SIZE = input.int(defval = 2, title = "SIZE", minval = 0, maxval = 4, tooltip = "Width 0-4", inline = "RSI1", group = GRRSI)RSI_TRANS = input.int(defval = 0, title = "TRNS", minval = 0, maxval = 100, tooltip = "Transparency 0-100", inline = "RSI1", group = GRRSI)RSIMA_COL1 = input.color(defval = color.blue, title = "RSIMA LINE", group = GRRSI, inline = "RSI2")RSIMA_COL2 = input.color(defval = color.teal, title = "", group = GRRSI, inline = "RSI2")RSIMA_SIZE = input.int(defval = 3, title = "SIZE", minval = 0, maxval = 4, tooltip = "Width 0-4", inline = "RSI2", group = GRRSI)RSIMA_TRANS = input.int(defval = 0, title = "TRNS", minval = 0, maxval = 100, tooltip = "Transparency 0-100", inline = "RSI2", group = GRRSI)up = ta.rma(math.max(ta.change(close), 0), RSI_LENGTH)down = ta.rma(-math.min(ta.change(close), 0), RSI_LENGTH)rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))vrsi = ta.rsi(close, RSI_LENGTH)RSIUP = ta.crossover(vrsi, RSI_OB)RSIDOWN = ta.crossunder(vrsi, RSI_OS)rsiMA = ta.sma(rsi, RSI_SMA)RSIBULL = ta.crossover(rsi, rsiMA)RSIBEAR = ta.crossunder(rsi, rsiMA)BULLRSI = rsi <= RSI_OBBEARRSI = rsi >= RSI_OSRSIc1 = rsi > rsiMA ? color.new(RSIMA_COL1, RSIMA_TRANS) : color.new(RSIMA_COL2, RSIMA_TRANS)plotshape(RSI_PLOT ? RSIUP : na, title='RSIUP', text = 'OB', color=color.new(color.yellow, 100), style=shape.circle, location=location.belowbar, size=size.auto)  //plot for buy iconplotshape(RSI_PLOT ? RSIDOWN : na, title='RSIDOWN', text = 'OS', color=color.new(color.red, 100), style=shape.circle, location=location.abovebar, size=size.auto)  //plot for buy iconplot(RSI_PLOT ? rsi : na, title = "RSI", color = color.new(RSI_COL,RSI_TRANS), linewidth = RSI_SIZE, style = plot.style_line)plot(RSI_PLOT ? rsiMA : na, title = "RSI-based MA", color=RSIc1, linewidth = RSIMA_SIZE, style = plot.style_line)Disable_Confirm = MACDConfirm_MODE == false and RSIConfirm_MODE == false and MACross_MODE == false and IchiConfirm_MODE == false and AroonConfirm_MODE == false//////////// INPUT BACKTEST RANGE ////////////////////////////////////////////////////var string BTR1         = '════════ INPUT BACKTEST TIME RANGE ════════'i_startTime             = input.time(defval = timestamp("01 Jan 1945 00:00 +0000"), title = "Start", inline="timestart", group=BTR1, tooltip = 'Start Backtest YYYY/MM/DD')i_endTime               = input.time(defval = timestamp("01 Jan 2074 23:59 +0000"), title = "End", inline="timeend", group=BTR1, tooltip = 'End Backtest YYYY/MM/DD')if time >= i_startTime and time <= i_endTime    // ##### BreakOut Strategy ######    if Spot_MODE == false        if MACDConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and MACDBull                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙MACD", alert_message = Alert_OpenLong)                if MACDBear                    strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻MACD", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBull                strategy.entry("Long", strategy.long, comment="Up🌙MACD", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBear                strategy.entry("Short", strategy.short, comment="Down👻MACD", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15) and MACDBull                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙MACD")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and MACDBear                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and MACDBull                    strategy.entry("Long", strategy.long, comment="X🌙MACD", alert_message = Alert_OpenLong)                if BearMACross and MACDBear                    strategy.entry("Short", strategy.short, comment="X👻MACD", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and MACDBull                    strategy.entry("Long", strategy.long, comment="X-Re🌙MACD", alert_message = Alert_OpenLong)                if BearMAPlus and MACDBear                    strategy.entry("Short", strategy.short, comment="X-Re👻MACD", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if (MACDStrategy_MODE == true and MACDStrategy_Repeat == true)                if MACDBull or macdTPl                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if MACDBear or macdTPs                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if (MACDStrategy_MODE == false and MACDStrategy_Repeat == true)                if MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if MACDBear                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and MACDBull                    strategy.entry("Long", strategy.long, comment="ATR🌙MACD", alert_message = Alert_OpenLong)                if ATRSCondition and MACDBear                    strategy.entry("Short", strategy.short, comment="ATR👻MACD", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and MACDBull                    strategy.entry("Long", strategy.long, comment="ATRR🌙MACD", alert_message = Alert_OpenLong)                if ShortRepeat and MACDBear                    strategy.entry("Short", strategy.short, comment="ATRR👻MACD", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and MACDBull and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙MACD", alert_message = Alert_OpenLong)                if ShortRepeat and MACDBear and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻MACD", alert_message = Alert_OpenShort)            if Forex_mode == true                if MACDBull                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙MACD", alert_message = Alert_OpenLong)                if MACDBear                    strategy.entry("Short", strategy.short, stop = close-atrs, comment = "FX👻MACD", alert_message = Alert_OpenShort)        if RSIConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and BULLRSI                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙RSI", alert_message = Alert_OpenLong)                if BEARRSI                    strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻RSI", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSI                strategy.entry("Long", strategy.long, comment="Up🌙RSI", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSI                strategy.entry("Short", strategy.short, comment="Down👻RSI", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15) and BULLRSI                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙RSI")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and BEARRSI                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMAPlus and BULLRSI                    strategy.entry("Long", strategy.long, comment="X🌙RSI", alert_message = Alert_OpenLong)                if BearMAPlus and BEARRSI                    strategy.entry("Short", strategy.short, comment="X👻RSI", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and BULLRSI                    strategy.entry("Long", strategy.long, comment="X-Re🌙RSI", alert_message = Alert_OpenLong)                if BearMAPlus and BEARRSI                    strategy.entry("Short", strategy.short, comment="X-Re👻RSI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and BULLRSI                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if macdTPs and BEARRSI                    strategy.entry("Short", strategy.short, comment="MACD👻RSI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (MACDBull and BULLRSI) or (macdTPl and BULLRSI)                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if (MACDBear and BEARRSI) or (macdTPs and BEARRSI)                    strategy.entry("Short", strategy.short, comment="MACD👻RSI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if MACDBull and BULLRSI                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if MACDBear and BEARRSI                    strategy.entry("Short", strategy.short, comment="MACD👻RSI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and BULLRSI                    strategy.entry("Long", strategy.long, comment="ATR🌙RSI", alert_message = Alert_OpenLong)                if ATRSCondition and BEARRSI                    strategy.entry("Short", strategy.short, comment="ATR👻RSI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and BULLRSI                    strategy.entry("Long", strategy.long, comment="ATRR🌙RSI", alert_message = Alert_OpenLong)                if ShortRepeat and BEARRSI                    strategy.entry("Short", strategy.short, comment="ATRR👻RSI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and BULLRSI and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙RSI", alert_message = Alert_OpenLong)                if ShortRepeat and BEARRSI and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻RSI", alert_message = Alert_OpenShort)            if Forex_mode == true                if BULLRSI                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙RSI", alert_message = Alert_OpenLong)                if BEARRSI                    strategy.entry("Short", strategy.short, stop = close-atrs, comment = "FX👻RSI", alert_message = Alert_OpenShort)        if MACross_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and BullMAPlus                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙MA", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻MA", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlus                strategy.entry("Long", strategy.long, comment="Up🌙MA", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlus                strategy.entry("Short", strategy.short, comment="Down👻MA", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15) and BullMAPlus                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙MA")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and BearMAPlus                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and BullMAPlus) or (MACDBull and BullMAPlus)                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if (macdTPs and BearMAPlus) or (MACDBear and BearMAPlus)                    strategy.entry("Short", strategy.short, comment="MACD👻MA", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if (macdTPl and BullMAPlus)                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if (macdTPs and BearMAPlus)                    strategy.entry("Short", strategy.short, comment="MACD👻MA", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and BullMAPlus)                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if (MACDBear and BearMAPlus)                    strategy.entry("Short", strategy.short, comment="MACD👻MA", alert_message = Alert_OpenShort)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross                    strategy.entry("Long", strategy.long, comment="X🌙", alert_message = Alert_OpenLong)                if BearMACross                    strategy.entry("Short", strategy.short, comment="X👻", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus                    strategy.entry("Long", strategy.long, comment="X-Re🌙", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.entry("Short", strategy.short, comment="X-Re👻", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and BullMAPlus                    strategy.entry("Long", strategy.long, comment="ATR🌙MA", alert_message = Alert_OpenLong)                if ATRSCondition and BearMAPlus                    strategy.entry("Short", strategy.short, comment="ATR👻MA", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and BullMAPlus                    strategy.entry("Long", strategy.long, comment="ATRR🌙MA", alert_message = Alert_OpenLong)                if ShortRepeat and BearMAPlus                    strategy.entry("Short", strategy.short, comment="ATRR👻MA", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and BullMAPlus and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙MA", alert_message = Alert_OpenLong)                if ShortRepeat and BearMAPlus and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻MA", alert_message = Alert_OpenShort)            if Forex_mode == true                if BullMAPlus                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙MA", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.entry("Short", strategy.short, stop = close-atrs, comment = "FX👻MA", alert_message = Alert_OpenShort)        if IchiConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and ichi_bullplus                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙ICHI", alert_message = Alert_OpenLong)                if ichi_bearplus                    strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻ICHI", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplus                strategy.entry("Long", strategy.long, comment="Up🌙ICHI", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplus                strategy.entry("Short", strategy.short, comment="Down👻ICHI", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15) and ichi_bullplus                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙ICHI")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and ichi_bearplus                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="X🌙ICHI", alert_message = Alert_OpenLong)                if BearMACross and ichi_bearplus                    strategy.entry("Short", strategy.short, comment="X👻ICHI", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="X-Re🌙ICHI", alert_message = Alert_OpenLong)                if BearMAPlus and ichi_bearplus                    strategy.entry("Short", strategy.short, comment="X-Re👻ICHI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus)                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if (macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus)                    strategy.entry("Short", strategy.short, comment="MACD👻ICHI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if (macdTPl and ichi_bullplus)                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if (macdTPs and ichi_bearplus)                    strategy.entry("Short", strategy.short, comment="MACD👻ICHI", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and ichi_bullplus)                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if (MACDBear and ichi_bearplus)                    strategy.entry("Short", strategy.short, comment="MACD👻ICHI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="ATR🌙ICHI", alert_message = Alert_OpenLong)                if ATRSCondition and ichi_bearplus                    strategy.entry("Short", strategy.short, comment="ATR👻ICHI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="ATRR🌙ICHI", alert_message = Alert_OpenLong)                if ShortRepeat and ichi_bearplus                    strategy.entry("Short", strategy.short, comment="ATRR👻ICHI", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and ichi_bullplus and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙ICHI", alert_message = Alert_OpenLong)                if ShortRepeat and ichi_bearplus and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻ICHI", alert_message = Alert_OpenShort)            if Forex_mode == true                if ichi_bullplus                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙ICHI", alert_message = Alert_OpenLong)                if ichi_bearplus                    strategy.entry("Short", strategy.short, stop = close-atrs, comment = "FX👻ICHI", alert_message = Alert_OpenShort)        if AroonConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and AroonHitUp                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙AR", alert_message = Alert_OpenLong)                if AroonHitDown                    strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻AR", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUp                strategy.entry("Long", strategy.long, comment="Up🌙AR", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDown                strategy.entry("Short", strategy.short, comment="Down👻AR", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15) and AroonHitUp                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙AR")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and AroonHitDown                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and AroonHitUp                    strategy.entry("Long", strategy.long, comment="X🌙AR", alert_message = Alert_OpenLong)                if BearMACross and AroonHitDown                    strategy.entry("Short", strategy.short, comment="X👻AR", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and AroonHitUp                    strategy.entry("Long", strategy.long, comment="X-Re🌙AR", alert_message = Alert_OpenLong)                if BearMAPlus and AroonHitDown                    strategy.entry("Short", strategy.short, comment="X-Re👻AR", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and AroonHitUp                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if macdTPs and AroonHitDown                    strategy.entry("Short", strategy.short, comment="MACD👻AR", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and AroonHitUp) or (MACDBull and AroonHitUp)                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if (macdTPs and AroonHitDown) or (MACDBear and AroonHitDown)                    strategy.entry("Short", strategy.short, comment="MACD👻AR", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and AroonHitUp)                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if (MACDBear and AroonHitDown)                    strategy.entry("Short", strategy.short, comment="MACD👻AR", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and AroonHitUp                    strategy.entry("Long", strategy.long, comment="ATR🌙AR", alert_message = Alert_OpenLong)                if ATRSCondition and AroonHitDown                    strategy.entry("Short", strategy.short, comment="ATR👻AR", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and AroonHitUp                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat and AroonHitDown                    strategy.entry("Short", strategy.short, comment="ATRR👻AR", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and AroonHitUp and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat and AroonHitDown and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻AR", alert_message = Alert_OpenShort)            if Forex_mode == true                if AroonHitUp                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙AR", alert_message = Alert_OpenLong)                if AroonHitDown                    strategy.entry("Short", strategy.short, stop = close-atrs, comment = "FX👻AR", alert_message = Alert_OpenShort)        if MACDConfirm_MODE == false and RSIConfirm_MODE == false and MACross_MODE == false and IchiConfirm_MODE == false and AroonConfirm_MODE == false            if BreakOut_MODE == true                if not na(close[lengthBO])                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙", alert_message = Alert_OpenLong)                strategy.entry("Short", strategy.short, stop=downBound - syminfo.mintick, comment="Break👻", alert_message = Alert_OpenShort)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na)                strategy.entry("Long", strategy.long, comment="Up🌙", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na)                strategy.entry("Short", strategy.short, comment="Down👻", alert_message = Alert_OpenShort)            // ##### 15m Strategy ######            if (longCondition15)                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong)                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15)                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross                    strategy.entry("Long", strategy.long, comment="X🌙", alert_message = Alert_OpenLong)                if BearMACross                    strategy.entry("Short", strategy.short, comment="X👻", alert_message = Alert_OpenShort)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus                    strategy.entry("Long", strategy.long, comment="X-Re🌙", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.entry("Short", strategy.short, comment="X-Re👻", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if macdTPl or MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs or MACDBear                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if MACDBear                    strategy.entry("Short", strategy.short, comment="MACD👻X", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition                    strategy.entry("Long", strategy.long, comment="ATR🌙", alert_message = Alert_OpenLong)                if ATRSCondition                    strategy.entry("Short", strategy.short, comment="ATR👻", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat                    strategy.entry("Long", strategy.long, comment="ATRR🌙", alert_message = Alert_OpenLong)                if ShortRepeat                    strategy.entry("Short", strategy.short, comment="ATRR👻", alert_message = Alert_OpenShort)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙", alert_message = Alert_OpenLong)                if ShortRepeat and S_Consecutive                    strategy.entry("Short", strategy.short, comment="ATRR👻", alert_message = Alert_OpenShort)            if Forex_mode == true                strategy.entry("Long", strategy.long, stop = close+atrs, comment = "Volty🌙", alert_message = Alert_OpenLong)                strategy.entry("Short", strategy.short, stop = close-atrs, comment = "Volty👻", alert_message = Alert_OpenShort)    if Spot_MODE == true        if MACDConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and MACDBull                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙MACD", alert_message = Alert_OpenLong)                if MACDBear                    strategy.close_all(immediately = true, comment="Break👻MACD", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBull                strategy.entry("Long", strategy.long, comment="Up🌙MACD", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBear                strategy.close_all(immediately = true, comment="Down👻MACD", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15) and MACDBull                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙MACD")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and MACDBear                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and MACDBull                    strategy.entry("Long", strategy.long, comment="X🌙MACD", alert_message = Alert_OpenLong)                if BearMACross and MACDBear                    strategy.close_all(immediately = true, comment="X👻MACD", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and MACDBull                    strategy.entry("Long", strategy.long, comment="X-Re🌙MACD", alert_message = Alert_OpenLong)                if BearMAPlus and MACDBear                    strategy.close_all(immediately = true, comment="X👻MACD", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if macdTPl or MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs or MACDBear                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if MACDBear                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and MACDBull                    strategy.entry("Long", strategy.long, comment="ATR🌙MACD", alert_message = Alert_OpenLong)                if ATRSCondition and MACDBear                    strategy.close_all(immediately = true, comment="ATR👻MACD", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and MACDBull                    strategy.entry("Long", strategy.long, comment="ATRR🌙MACD", alert_message = Alert_OpenLong)                if ShortRepeat and MACDBear                    strategy.close_all(immediately = true, comment="ATRR👻MACD", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and MACDBull and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙MACD", alert_message = Alert_OpenLong)                if ShortRepeat and MACDBear and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻MACD", alert_message = Alert_StopLosslong)            if Forex_mode == true                if MACDBull                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙MACD", alert_message = Alert_OpenLong)                if MACDBear                    strategy.exit("Exit_LFX", "Long", stop = close-atrs, comment = "FX👻MACD", alert_message = Alert_StopLosslong)        if RSIConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and BULLRSI                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙RSI", alert_message = Alert_OpenLong)                if BEARRSI                    strategy.close_all(immediately = true, comment="Break👻RSI", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSI                strategy.entry("Long", strategy.long, comment="Up🌙RSI", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSI                strategy.close_all(immediately = true, comment="Down👻RSI", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15) and BULLRSI                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙RSI")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and BEARRSI                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and BULLRSI                    strategy.entry("Long", strategy.long, comment="X🌙RSI", alert_message = Alert_OpenLong)                if BearMACross and BEARRSI                    strategy.close_all(immediately = true, comment="X👻RSI", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and BULLRSI                    strategy.entry("Long", strategy.long, comment="X-Re🌙RSI", alert_message = Alert_OpenLong)                if BearMAPlus and BEARRSI                    strategy.close_all(immediately = true, comment="X👻RSI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and BULLRSI                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if macdTPs and BEARRSI                    strategy.close_all(immediately = true, comment="MACD👻RSI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and BULLRSI) or (MACDBull and BULLRSI)                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if (macdTPs and BEARRSI) or (MACDBear and BEARRSI)                    strategy.close_all(immediately = true, comment="MACD👻RSI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and BULLRSI)                    strategy.entry("Long", strategy.long, comment="MACD🌙RSI", alert_message = Alert_OpenLong)                if (MACDBear and BEARRSI)                    strategy.close_all(immediately = true, comment="MACD👻RSI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and BULLRSI                    strategy.entry("Long", strategy.long, comment="ATR🌙RSI", alert_message = Alert_OpenLong)                if ATRSCondition and BEARRSI                    strategy.close_all(immediately = true, comment="ATR👻RSI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and BULLRSI                    strategy.entry("Long", strategy.long, comment="ATRR🌙RSI", alert_message = Alert_OpenLong)                if ShortRepeat and BEARRSI                    strategy.close_all(immediately = true, comment="ATRR👻RSI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and BULLRSI and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙RSI", alert_message = Alert_OpenLong)                if ShortRepeat and BEARRSI and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻RSI", alert_message = Alert_StopLosslong)            if Forex_mode == true                if BULLRSI                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙RSI", alert_message = Alert_OpenLong)                if BEARRSI                    strategy.exit("Exit_LFX", "Long", stop = close-atrs, comment = "FX👻RSI", alert_message = Alert_StopLosslong)        if MACross_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and BullMAPlus                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙MA", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.close_all(immediately = true, comment="Break👻MA", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlus                strategy.entry("Long", strategy.long, comment="Up🌙MA", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlus                strategy.close_all(immediately = true, comment="Down👻MA", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15) and BullMAPlus                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙MA")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and BearMAPlus                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and BullMAPlus                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if macdTPs and BearMAPlus                    strategy.close_all(immediately = true, comment="MACD👻MA", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and BullMAPlus) or (MACDBull and BullMAPlus)                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if (macdTPs and BearMAPlus) or (MACDBear and BearMAPlus)                    strategy.close_all(immediately = true, comment="MACD👻MA", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and BullMAPlus)                    strategy.entry("Long", strategy.long, comment="MACD🌙MA", alert_message = Alert_OpenLong)                if (MACDBear and BearMAPlus)                    strategy.close_all(immediately = true, comment="MACD👻MA", alert_message = Alert_StopLosslong)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross                    strategy.entry("Long", strategy.long, comment="X🌙MA", alert_message = Alert_OpenLong)                if BearMACross                    strategy.close_all(immediately = true, comment="X👻MA", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus                    strategy.entry("Long", strategy.long, comment="X-Re🌙MA", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.close_all(immediately = true, comment="X👻MA", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and BullMAPlus                    strategy.entry("Long", strategy.long, comment="ATR🌙MA", alert_message = Alert_OpenLong)                if ATRSCondition and BearMAPlus                    strategy.close_all(immediately = true, comment="ATR👻MA", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and BullMAPlus                    strategy.entry("Long", strategy.long, comment="ATRR🌙MA", alert_message = Alert_OpenLong)                if ShortRepeat and BearMAPlus                    strategy.close_all(immediately = true, comment="ATRR👻MA", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and BullMAPlus and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙MA", alert_message = Alert_OpenLong)                if ShortRepeat and BearMAPlus and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻MA", alert_message = Alert_StopLosslong)            if Forex_mode == true                if BullMAPlus                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙MA", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.exit("Exit_LFX", "Long", stop = close-atrs, comment = "FX👻MA", alert_message = Alert_StopLosslong)        if IchiConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and ichi_bullplus                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙ICHI", alert_message = Alert_OpenLong)                if ichi_bearplus                    strategy.close_all(immediately = true, comment="Break👻ICHI", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplus                strategy.entry("Long", strategy.long, comment="Up🌙ICHI", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplus                strategy.close_all(immediately = true, comment="Down👻ICHI", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15) and ichi_bullplus                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙ICHI")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and ichi_bearplus                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="X🌙ICHI", alert_message = Alert_OpenLong)                if BearMACross and ichi_bearplus                    strategy.close_all(immediately = true, comment="X👻ICHI", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="X-Re🌙ICHI", alert_message = Alert_OpenLong)                if BearMAPlus and ichi_bearplus                    strategy.close_all(immediately = true, comment="X👻ICHI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if macdTPs and ichi_bearplus                    strategy.close_all(immediately = true, comment="MACD👻ICHI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus)                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if (macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus)                    strategy.close_all(immediately = true, comment="MACD👻ICHI", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and ichi_bullplus)                    strategy.entry("Long", strategy.long, comment="MACD🌙ICHI", alert_message = Alert_OpenLong)                if (MACDBear and ichi_bearplus)                    strategy.close_all(immediately = true, comment="MACD👻ICHI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="ATR🌙ICHI", alert_message = Alert_OpenLong)                if ATRSCondition and ichi_bearplus                    strategy.close_all(immediately = true, comment="ATR👻ICHI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and ichi_bullplus                    strategy.entry("Long", strategy.long, comment="ATRR🌙ICHI", alert_message = Alert_OpenLong)                if ShortRepeat and ichi_bearplus                    strategy.close_all(immediately = true, comment="ATRR👻ICHI", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and ichi_bullplus and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙ICHI", alert_message = Alert_OpenLong)                if ShortRepeat and ichi_bearplus and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻ICHI", alert_message = Alert_StopLosslong)            if Forex_mode == true                if ichi_bullplus                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙ICHI", alert_message = Alert_OpenLong)                if ichi_bearplus                    strategy.exit("Exit_LFX", "Long", stop = close-atrs, comment = "FX👻ICHI", alert_message = Alert_StopLosslong)        if AroonConfirm_MODE == true            if BreakOut_MODE == true                if not na(close[lengthBO]) and AroonHitUp                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙AR", alert_message = Alert_OpenLong)                if AroonHitDown                    strategy.close_all(immediately = true, comment="Break👻AR", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUp                strategy.entry("Long", strategy.long, comment="Up🌙AR", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDown                strategy.close_all(immediately = true, comment="Down👻AR", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15) and AroonHitUp                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong, comment = "15m🌙AR")                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15) and AroonHitDown                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross and AroonHitUp                    strategy.entry("Long", strategy.long, comment="X🌙AR", alert_message = Alert_OpenLong)                if BearMACross and AroonHitDown                    strategy.close_all(immediately = true, comment="X👻AR", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus and AroonHitUp                    strategy.entry("Long", strategy.long, comment="X-Re🌙AR", alert_message = Alert_OpenLong)                if BearMAPlus and AroonHitDown                    strategy.close_all(immediately = true, comment="X👻AR", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl and AroonHitUp                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if macdTPs and AroonHitDown                    strategy.close_all(immediately = true, comment="MACD👻AR", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if (macdTPl and AroonHitUp) or (MACDBull and AroonHitUp)                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if (macdTPs and AroonHitDown) or (MACDBear and AroonHitDown)                    strategy.close_all(immediately = true, comment="MACD👻AR", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if (MACDBull and AroonHitUp)                    strategy.entry("Long", strategy.long, comment="MACD🌙AR", alert_message = Alert_OpenLong)                if (MACDBear and AroonHitDown)                    strategy.close_all(immediately = true, comment="MACD👻AR", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition and AroonHitUp                    strategy.entry("Long", strategy.long, comment="ATR🌙AR", alert_message = Alert_OpenLong)                if ATRSCondition and AroonHitDown                    strategy.close_all(immediately = true, comment="ATR👻AR", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat and AroonHitUp                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat and AroonHitDown                    strategy.close_all(immediately = true, comment="ATRR👻AR", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and AroonHitUp and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat and AroonHitDown and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻AR", alert_message = Alert_StopLosslong)            if Forex_mode == true                if AroonHitUp                    strategy.entry("Long", strategy.long, stop = close+atrs, comment = "FX🌙AR", alert_message = Alert_OpenLong)                if AroonHitDown                    strategy.exit("Exit_LFX", "Long", stop = close-atrs, comment = "FX👻AR", alert_message = Alert_StopLosslong)        if MACDConfirm_MODE == false and RSIConfirm_MODE == false and MACross_MODE == false and IchiConfirm_MODE == false and AroonConfirm_MODE == false            if BreakOut_MODE == true                if not na(close[lengthBO])                    strategy.entry("Long", strategy.long, stop=upBound + syminfo.mintick, comment="Break🌙", alert_message = Alert_OpenLong)                strategy.exit("Long", qty_percent = 100,stop = downBound - syminfo.mintick,comment="Break👻", alert_message = Alert_StopLosslong)            // ##### Consecutive Strategy #######            if (Consecutive_MODE ? ups >= consecutiveBarsUp : na)                strategy.entry("Long", strategy.long, comment="Up🌙", alert_message = Alert_OpenLong)            if (Consecutive_MODE ? dns >= consecutiveBarsDown : na)                strategy.close_all(immediately = true, comment="Down👻", alert_message = Alert_StopLosslong)            // ##### 15m Strategy ######            if (longCondition15)                strategy.entry("Long", strategy.long, alert_message = Alert_OpenLong)                alert("15m BREAK UP", freq = alert.freq_once_per_bar_close)            if (shortCondition15)                strategy.close_all("15m BREAK DOWN", immediately = true, alert_message = Alert_StopLosslong)                alert("15m BREAK DOWN", freq = alert.freq_once_per_bar_close)            if MAStrategy_MODE == true and MARepeat_Mode == false                if BullMACross                    strategy.entry("Long", strategy.long, comment="X🌙", alert_message = Alert_OpenLong)                if BearMACross                    strategy.close_all(immediately = true, comment="X👻", alert_message = Alert_StopLosslong)            if (MAStrategy_MODE == true and MARepeat_Mode == true) or (MAStrategy_MODE == false and MARepeat_Mode == true)                if BullMAPlus                    strategy.entry("Long", strategy.long, comment="X-Re🌙", alert_message = Alert_OpenLong)                if BearMAPlus                    strategy.close_all(immediately = true, comment="X👻", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == false                if macdTPl                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == true and MACDStrategy_Repeat == true                if macdTPl or MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if macdTPs or MACDBear                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if MACDStrategy_MODE == false and MACDStrategy_Repeat == true                if MACDBull                    strategy.entry("Long", strategy.long, comment="MACD🌙X", alert_message = Alert_OpenLong)                if MACDBear                    strategy.close_all(immediately = true, comment="MACD👻X", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == false and volty_conse == false and Forex_mode == false                if ATRLCondition                    strategy.entry("Long", strategy.long, comment="ATR🌙AR", alert_message = Alert_OpenLong)                if ATRSCondition                    strategy.close_all(immediately = true, comment="ATR👻AR", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == false and Forex_mode == false                if LongRepeat                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat                    strategy.close_all(immediately = true, comment="ATRR👻AR", alert_message = Alert_StopLosslong)            if volty_mode == true and Repeat_mode == true and volty_conse == true and Forex_mode == false                if LongRepeat and L_Consecutive                    strategy.entry("Long", strategy.long, comment="ATRR🌙AR", alert_message = Alert_OpenLong)                if ShortRepeat and S_Consecutive                    strategy.close_all(immediately = true, comment="ATRR👻AR", alert_message = Alert_StopLosslong)            if Forex_mode == true                strategy.entry("Long", strategy.long, stop = close+atrs, comment = "Volty🌙", alert_message = Alert_OpenLong)                strategy.exit("Spot_ExitFX","Long", stop = close-atrs, comment = "Volty👻", alert_message = Alert_OpenShort)////////////////////////////////////////////////////////////////////////////////////////////////////////////////    if mode == true    if Spot_MODE == false        if (strategy.position_size > 0)            if sl > 0                stoploss := calcStopLossPrice(sl)                stoploss_l := stoploss            else if sl <= 0                stoploss := na            if tp_l > 0                takeprofit := tp_l                takeprofit_ll := close + ((close/100)*tp_l)                //takeprofit_s := na            else if tp_l <= 0                takeprofit := na        if (strategy.position_size < 0)            if sl > 0                stoploss := calcStopLossPrice(sl)                stoploss_s := stoploss            else if sl <= 0                stoploss := na            if tp_s > 0                takeprofit := tp_s                takeprofit_ss := close - ((close/100)*tp_s)                //takeprofit_l := na            else if tp_s <= 0                takeprofit := na        else if strategy.position_size == 0            stoploss := na            takeprofit := na    if Spot_MODE == true        if (strategy.position_size > 0)            if sl > 0                stoploss := calcStopLossPrice(sl)                stoploss_l := stoploss            else if sl <= 0                stoploss := na            if tp_l > 0                takeprofit := tp_l                takeprofit_ll := close + ((close/100)*tp_l)                //takeprofit_s := na            else if tp_l <= 0                takeprofit := na        else if strategy.position_size == 0            stoploss := na            takeprofit := naif mode == true    if Spot_MODE == false        if strategy.position_size > 0            strategy.exit("Exit",'Long', qty_percent = 100 , profit = takeprofit, stop = stoploss, alert_message = Alert_StopLosslong, comment_profit = "TP💚L", comment_loss = "SL💚L")        if strategy.position_size < 0            strategy.exit("Exit",'Short', qty_percent = 100, profit = takeprofit, stop = stoploss, alert_message = Alert_StopLossshort, comment_profit = "TP❤️️S", comment_loss = "SL❤️️S")    if Spot_MODE == true        if strategy.position_size > 0            strategy.exit("Exit",'Long', qty_percent = 100, profit = takeprofit, stop = stoploss, alert_message = Alert_StopLosslong, comment_profit = "TP💚L", comment_loss = "SL💚L")//===================== เรียกใช้  library =========================import X4815162342/X48_LibaryStrategyStatus/2 as fuLi //แสดงผล Backtestshow_Net = input.bool(true,'Monitor Profit&Loss', inline = 'Lnet', group = '= PNL MONITOR SETTING =')position_ = input.string('bottom_center','Position', options = ['top_right','middle_right','bottom_right','top_center','middle_center','bottom_center','middle_left','bottom_left'] , inline = 'Lnet')size_i = input.string('auto','size', options = ['auto','tiny','small','normal'] , inline = 'Lnet') color_Net = input.color(color.blue,"" , inline = 'Lnet')fuLi.NetProfit_Show(show_Net , position_ , size_i,  color_Net )