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
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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| 🍀🍀🍀 SPOT MODE 🍀🍀🍀 | |||
| 🍀 SPOT MODE | false | bool | line 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 Strategy | true | bool | entry 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 Strategy | false | bool | entry 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] | false | bool | longCondition15 shortCondition15 |
| 4️⃣ MA CROSS X STRATEGY MODE | false | bool | line 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 Again | false | bool | line 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 MODE | false | bool | line 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 Again | false | bool | line 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 Signal | false | bool | Disable_Confirm line 590 line 905 line 966 line 1281 |
| 🉐 RSI CONFIRM MODEUse Stochastic For Confirm Signal | false | bool | Disable_Confirm line 653 line 905 line 1029 line 1281 |
| 💯 MA CROSS X CONFIRM MODEUse MA Type Cross For Confirm Signal | false | bool | Disable_Confirm line 716 line 905 line 1092 line 1281 |
| 💮 ICHIMOKU TENKAN&KIJUN CROSS X CONFIRM MODEUse Ichimoku Tenkan & Kijun Cross For Confirm Signal | false | bool | Disable_Confirm line 779 line 905 line 1155 line 1281 |
| 🍩AROON 100% & -100% CONFIRM | false | bool | Disable_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 Swing | false | bool | Top Levels Bottom Levels Top Levels 2 Bottom Levels 2 line 217 |
| 🆑 ATR Trailing Stop | false | bool | Fast 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 15m | false | bool | line 156 |
| 🆘 Take Profit & Stop Loss By Percent (%)Take Profit & Stop Loss by % Change | false | bool | line 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% | false | bool | entry 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.1 | false | bool | newsig 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 SL | false | bool | 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 |
| 🎯 Consecutive Bars Filter For Repeat SignalConsecutive Bars Filter For Signal Repeat New Position After TP and SL | false | bool | 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 |
| Adaptive ATR Candle Length | 5 | int · min 1 | atrs atr |
| Adaptive ATR Multiply | 0.75 | float · min 0.1 | atrs |
| FAST Adaptive ATR LINE - After Calculate | 8 | int · min 1 | newsig |
| SLOW Adaptive ATR LINE - After Calculate | 32 | int · min 1 | newsig2 |
| Bot Setting \n >> If You Dont Use Bot Just Pass It | |||
| Alert Message for BOTAlert For X48-BOT > Copy and Paste To Alert Function | Text_Alert_Future | value | unused |
| Bot PassPassphrase Must Be Same as X48-BOT | 1234 | string | Alert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort |
| leverage"NOTHING" to do with Position size For Command To X48-BOT Only | 125 | int · min 1 | Alert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort |
| Bot Long Command1.OpenLong\n2.AutoLong\n***If AutoLong = Close(100%) First > Open Long Position Auto | AutoLong | string | Alert_OpenLong |
| Bot Short Command1.OpenShort\n2.AutoShort\n***If AutoShort = Close(100%) First > Open Short Position Auto | AutoShort | string | Alert_OpenShort |
| Future/Spot Command1. bnfuture = FUTURE MODE\n2. bnspot = SPOT MODE\n 3.bncombo = EZ 2in1 Order | bnfuture | string | Alert_OpenLong Alert_OpenShort Alert_StopLosslong Alert_StopLossshort |
| 1️⃣1️⃣1️⃣ CHANNEL BREAKOUT STRATEGY 1️⃣1️⃣1️⃣ | |||
| [PLOT] BreakOut LINE [PLOT] | false | bool | Top LevelsBO Bottom LevelsBO |
| 1️⃣ Length BreakOut | 5 | int · min 1 · max 1000 | upBound 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 >< | 25 | float · min 0.01 · max 999.99 | SL_LongBO SL_ShortBO |
| 2️⃣2️⃣2️⃣ Consecutive Up/Down Strategy 2️⃣2️⃣2️⃣ | |||
| 2️⃣ Consecutive BarsUp | 3 | int · min 1 | 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 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 BarsDown | 3 | int · min 1 | entry 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] | false | bool | Range H-L H-L SD Close Direction |
| 3️⃣ 15m - Lookback | 2 | int · min 1 | longCondition15 shortCondition15 Close Direction |
| 3️⃣ 15m - Range Length | 10 | int · min 1 | computation |
| 15m - SD | 2.0 | float · min 0.001 · max 50 | computation atr |
| 🆎🆎🆎 TP/SL SWING SETTING 🆎🆎🆎 | |||
| 🆎 Pivot Length Left Hand Side | 3 | int · min 1 | pvthi_ pvtlo_ |
| 🆎 Pivot Length Right Hand Side | 3 | int · min 1 | pvthi_ pvtlo_ Top Levels Bottom Levels |
| ENGULFING SIGNAL | |||
| Normal Engulfing Signal | false | bool | barcolor plotshape |
| 3 Candle Engulfing Signal | false | bool | plotshape barcolor |
| 💯💯💯4️⃣ Multi MA SETTING 4️⃣💯💯💯 | |||
| 💯4️⃣ Source Multi MANormal Line = Close \nSmooth Line = ohlc4 | close | source | pricestrategy |
| Show Fast MA Line | false | bool | Fast MA Fast MA |
| Fast MA Color | color.new(color.red,0) | color | Fast MA |
| Show Slow MA Line | false | bool | Slow MA Fast MA |
| Slow MA Color | color.new(color.yellow,0) | color | Slow MA |
| 💯4️⃣ Fast MA Length | 12 | int | price1strategy |
| Fast MA TypeSMA / EMA / WMA / HMA / RMA / VWMA | EMA | string · options ['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'] | price1strategy |
| 💯4️⃣ Slow MA Length | 26 | int | price3strategy |
| Slow MA TypeSMA / EMA / WMA / HMA / RMA / VWMA | EMA | string · options ['SMA', 'EMA', 'WMA', 'HMA', 'RMA', 'VWMA'] | price3strategy |
| DONCHIAN FANS MODE | |||
| DONCHIAN FANS MODE | false | bool | line 385 line 392 |
| DONCHIAN BOLLINGER LINE | false | bool | H M L |
| FANS length: | 100 | int · min 1 | h_price h_bar l_price l_bar r |
| 💮💮💮 ICHIMOKU SETTING 💮💮💮 | |||
| ICHIMOKU PLOT MODE | false | bool | Senkou Span A Senkou Span B Tenkan-Sen Kijun-Sen Crossover Crossunder Chikou |
| 💮 Tenkan TENKAN = FAST SIGNAL | 9 | int | tenkan |
| Tenkan mult (no label in the script) | 2. | float | tenkan |
| 💮 Kijun KIJUN = SLOW SIGNAL | 26 | int | kijun |
| Kijun mult (no label in the script) | 4. | float | kijun |
| Senkou Span A/B SENKOU = CLOUD SIGNAL | 52 | int | senkouB |
| Span B mult (no label in the script) | 6. | float | senkouB |
| CLOUD-A | color.new(color.orange,20) | color | cloud_a |
| CLOUD-B | color.new(color.purple,20) | color | cloud_b |
| Chikou-Color | color.new(#73ecff,0) | color | Chikou |
| ChikouCHIKOU = CANDLE LOOK BACK DEFAULT = 26 | 26 | int | Senkou 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 Down | false | bool | macdTPl macdTPs |
| 🅰️5️⃣ MACD Fast | 12 | int | MACD |
| 🅰️5️⃣ MACD Slow | 26 | int | MACD |
| 🅰️5️⃣ MACD Length | 18 | int | aMACD |
| CROSS-UP | color.new(color.green,0) | color | macdTPl |
| CROSS-DOWN | color.new(color.red,0) | color | macdTPs |
| 🆘🆘🆘 TAKE PROFIT & STOP LOSS BY [%] 🆘🆘🆘 | |||
| 🆘 TP [LONG] % | 99999 | float | takeprofit takeprofit_ll line 1350 line 1354 line 1378 line 1382 |
| 🆘 TP [SHORT] % | 33.3 | float | takeprofit takeprofit_ss line 1362 line 1366 |
| 🆘 Stop Loss % | 0 | float | stoploss line 1345 line 1348 line 1357 line 1360 line 1373 line 1376 |
| 🆑🆑🆑 ATR TRAILING STOP 🆑🆑🆑 | |||
| 🆑 Fast ATR period | 5 | int | SL1 |
| 🆑 Fast ATR multiplier | 0.5 | float | SL1 |
| 🆑 Slow ATR period | 10 | int | SL2 |
| 🆑 Slow ATR multiplier | 2 | float | SL2 |
| 🍩🍩🍩 AROON SETTING 🍩🍩🍩 | |||
| AROON LENGTH | 14 | int · min 1 | AroonUpper AroonLower |
| 🉐 RSI MODE | |||
| 🉐=== RSI LINE === | false | bool | RSIUP RSIDOWN RSI RSI-based MA |
| 🉐 RSI OverBoughtRSI OB | 50 | int · min 1 · max 100 | RSIUP BULLRSI |
| 🉐 RSI OverSoldRSI OS | 50 | int · min 1 · max 100 | RSIDOWN BEARRSI |
| RSI LENGTHRSI LENGTH | 14 | int · min 1 · max 999 | up down vrsi |
| RSI SMA LENGTHRSI SMA LENGTH FOR PREDICT TREND | 50 | int · min 1 · max 999 | rsiMA |
| RSI LINE | color.white | color | RSI |
| SIZEWidth 0-4 | 2 | int · min 0 · max 4 | RSI |
| TRNSTransparency 0-100 | 0 | int · min 0 · max 100 | RSI |
| RSIMA LINE | color.blue | color | RSIc1 |
| RSIMA COL2 (no label in the script) | color.teal | color | RSIc1 |
| SIZEWidth 0-4 | 3 | int · min 0 · max 4 | RSI-based MA |
| TRNSTransparency 0-100 | 0 | int · min 0 · max 100 | RSIc1 |
| INPUT BACKTEST TIME RANGE | |||
| StartStart Backtest YYYY/MM/DD | timestamp("01 Jan 1945 00:00 +0000") | time | line 587 |
| EndEnd Backtest YYYY/MM/DD | timestamp("01 Jan 2074 23:59 +0000") | time | line 587 |
| PNL MONITOR SETTING | |||
| Monitor Profit&Loss | true | bool | line 1403 |
| Position | bottom_center | string · options ['top_right','middle_right','bottom_right','top_center','middle_center','bottom_center','middle_left','bottom_left'] | line 1403 |
| size | auto | string · options ['auto','tiny','small','normal'] | line 1403 |
| Color Net (no label in the script) | color.blue | color | line 1403 |
What it calculates
- SMAta.tr, Adaptive ATR Candle Length (5)
atrs · line 95 - EMAbuycon, 12
buysig · line 99 - EMAsellcon, 12
sellsig · 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, newsig2
ATRLCondition · line 103 - Crossundernewsig, newsig2
ATRSCondition · 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, pvtlos
stopswinglow · line 215 - Crossoverclose, pvthis
stopswinghigh · line 216 - EMA / SMA / WMA / HMA / RMA / VWMApricestrategy, 💯4️⃣ Fast MA Length (12) · chosen by Fast MA Type
price1strategy · line 297 - EMA / SMA / WMA / HMA / RMA / VWMApricestrategy, 💯4️⃣ Slow MA Length (26) · chosen by Slow MA Type
price3strategy · line 305 - Crossoverprice1strategy, price3strategy
BullMACross · line 314 - Crossunderprice1strategy, price3strategy
BearMACross · 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, spt
max · line 424 - Crosssrc, spt
min · line 425 - Crossovertenkan, kijun
ichi_bull · line 445 - Crossundertenkan, kijun
ichi_bear · line 446 - EMAclose, 🅰️5️⃣ MACD Fast (12)
MACD · line 462 - EMAMACD, 🅰️5️⃣ MACD Length (18)
aMACD · line 463 - Crossoverdelta, 0
macdTPl · line 465 - Crossunderdelta, 0
macdTPs · line 466 - ATR🆑 Fast ATR period (5)
SL1 · line 521 - ATR🆑 Slow ATR period (10)
SL2 · line 529 - CrossoverTrail1, Trail2
BuyLong · line 534 - CrossunderTrail1, Trail2
SellShort · line 535 - Highestbarshigh, AROON LENGTH (14)
AroonUpper · line 547 - Lowestbarslow, AROON LENGTH (14)
AroonLower · line 548 - CrossoverAroonUpper, AroonLower
AroonCrossUp · line 549 - CrossunderAroonUpper, AroonLower
AroonCrossDown · 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, rsiMA
RSIBULL · line 573 - Crossunderrsi, rsiMA
RSIBEAR · 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
| Order | Fires when | By default | Line |
|---|---|---|---|
| Close Long | SL_LongBO and strategy.position_size > 0 | On | 159 |
| Close Short | SL_ShortBO and strategy.position_size < 0 | On | 161 |
| Close Long | SL_LongBO and strategy.position_size > 0 | On | 164 |
| Close Long | (close < pvtlos) | On | 220 |
| Close Short | (close > pvthis) | On | 222 |
| Close Long | (close < pvtlos) | On | 225 |
| Close Short | BuyLong and strategy.position_size < 0 | On | 540 |
| Close Long | SellShort and strategy.position_size > 0 | On | 542 |
| Open Long long | not na(close[lengthBO]) and MACDBull | On | 593 |
| Open Short short | MACDBear | On | 595 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBull | On | 598 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBear | On | 600 |
| Open Long long | (longCondition15) and MACDBull | On | 603 |
| Close 15m BREAK DOWN | (shortCondition15) and MACDBear | On | 606 |
| Open Long long | BullMACross and MACDBull | On | 610 |
| Open Short short | BearMACross and MACDBear | On | 612 |
| Open Long long | BullMAPlus and MACDBull | On | 615 |
| Open Short short | BearMAPlus and MACDBear | On | 617 |
| Open Long long | macdTPl | On | 620 |
| Open Short short | macdTPs | On | 622 |
| Open Long long | MACDBull or macdTPl | On | 625 |
| Open Short short | MACDBear or macdTPs | On | 627 |
| Open Long long | MACDBull | On | 630 |
| Open Short short | MACDBear | On | 632 |
| Open Long long | ATRLCondition and MACDBull | On | 635 |
| Open Short short | ATRSCondition and MACDBear | On | 637 |
| Open Long long | LongRepeat and MACDBull | On | 640 |
| Open Short short | ShortRepeat and MACDBear | On | 642 |
| Open Long long | LongRepeat and MACDBull and L_Consecutive | On | 645 |
| Open Short short | ShortRepeat and MACDBear and S_Consecutive | On | 647 |
| Open Long long | MACDBull | On | 650 |
| Open Short short | MACDBear | On | 652 |
| Open Long long | not na(close[lengthBO]) and BULLRSI | On | 656 |
| Open Short short | BEARRSI | On | 658 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSI | On | 661 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSI | On | 663 |
| Open Long long | (longCondition15) and BULLRSI | On | 666 |
| Close 15m BREAK DOWN | (shortCondition15) and BEARRSI | On | 669 |
| Open Long long | BullMAPlus and BULLRSI | On | 673 |
| Open Short short | BearMAPlus and BEARRSI | On | 675 |
| Open Long long | BullMAPlus and BULLRSI | On | 678 |
| Open Short short | BearMAPlus and BEARRSI | On | 680 |
| Open Long long | macdTPl and BULLRSI | On | 683 |
| Open Short short | macdTPs and BEARRSI | On | 685 |
| Open Long long | (MACDBull and BULLRSI) or (macdTPl and BULLRSI) | On | 688 |
| Open Short short | (MACDBear and BEARRSI) or (macdTPs and BEARRSI) | On | 690 |
| Open Long long | MACDBull and BULLRSI | On | 693 |
| Open Short short | MACDBear and BEARRSI | On | 695 |
| Open Long long | ATRLCondition and BULLRSI | On | 698 |
| Open Short short | ATRSCondition and BEARRSI | On | 700 |
| Open Long long | LongRepeat and BULLRSI | On | 703 |
| Open Short short | ShortRepeat and BEARRSI | On | 705 |
| Open Long long | LongRepeat and BULLRSI and L_Consecutive | On | 708 |
| Open Short short | ShortRepeat and BEARRSI and S_Consecutive | On | 710 |
| Open Long long | BULLRSI | On | 713 |
| Open Short short | BEARRSI | On | 715 |
| Open Long long | not na(close[lengthBO]) and BullMAPlus | On | 719 |
| Open Short short | BearMAPlus | On | 721 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlus | On | 724 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlus | On | 726 |
| Open Long long | (longCondition15) and BullMAPlus | On | 729 |
| Close 15m BREAK DOWN | (shortCondition15) and BearMAPlus | On | 732 |
| Open Long long | (macdTPl and BullMAPlus) or (MACDBull and BullMAPlus) | On | 736 |
| Open Short short | (macdTPs and BearMAPlus) or (MACDBear and BearMAPlus) | On | 738 |
| Open Long long | (macdTPl and BullMAPlus) | On | 741 |
| Open Short short | (macdTPs and BearMAPlus) | On | 743 |
| Open Long long | (MACDBull and BullMAPlus) | On | 746 |
| Open Short short | (MACDBear and BearMAPlus) | On | 748 |
| Open Long long | BullMACross | On | 751 |
| Open Short short | BearMACross | On | 753 |
| Open Long long | BullMAPlus | On | 756 |
| Open Short short | BearMAPlus | On | 758 |
| Open Long long | ATRLCondition and BullMAPlus | On | 761 |
| Open Short short | ATRSCondition and BearMAPlus | On | 763 |
| Open Long long | LongRepeat and BullMAPlus | On | 766 |
| Open Short short | ShortRepeat and BearMAPlus | On | 768 |
| Open Long long | LongRepeat and BullMAPlus and L_Consecutive | On | 771 |
| Open Short short | ShortRepeat and BearMAPlus and S_Consecutive | On | 773 |
| Open Long long | BullMAPlus | On | 776 |
| Open Short short | BearMAPlus | On | 778 |
| Open Long long | not na(close[lengthBO]) and ichi_bullplus | On | 782 |
| Open Short short | ichi_bearplus | On | 784 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplus | On | 787 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplus | On | 789 |
| Open Long long | (longCondition15) and ichi_bullplus | On | 792 |
| Close 15m BREAK DOWN | (shortCondition15) and ichi_bearplus | On | 795 |
| Open Long long | BullMACross and ichi_bullplus | On | 799 |
| Open Short short | BearMACross and ichi_bearplus | On | 801 |
| Open Long long | BullMAPlus and ichi_bullplus | On | 804 |
| Open Short short | BearMAPlus and ichi_bearplus | On | 806 |
| Open Long long | (macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus) | On | 809 |
| Open Short short | (macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus) | On | 811 |
| Open Long long | (macdTPl and ichi_bullplus) | On | 814 |
| Open Short short | (macdTPs and ichi_bearplus) | On | 816 |
| Open Long long | (MACDBull and ichi_bullplus) | On | 819 |
| Open Short short | (MACDBear and ichi_bearplus) | On | 821 |
| Open Long long | ATRLCondition and ichi_bullplus | On | 824 |
| Open Short short | ATRSCondition and ichi_bearplus | On | 826 |
| Open Long long | LongRepeat and ichi_bullplus | On | 829 |
| Open Short short | ShortRepeat and ichi_bearplus | On | 831 |
| Open Long long | LongRepeat and ichi_bullplus and L_Consecutive | On | 834 |
| Open Short short | ShortRepeat and ichi_bearplus and S_Consecutive | On | 836 |
| Open Long long | ichi_bullplus | On | 839 |
| Open Short short | ichi_bearplus | On | 841 |
| Open Long long | not na(close[lengthBO]) and AroonHitUp | On | 845 |
| Open Short short | AroonHitDown | On | 847 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUp | On | 850 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDown | On | 852 |
| Open Long long | (longCondition15) and AroonHitUp | On | 855 |
| Close 15m BREAK DOWN | (shortCondition15) and AroonHitDown | On | 858 |
| Open Long long | BullMACross and AroonHitUp | On | 862 |
| Open Short short | BearMACross and AroonHitDown | On | 864 |
| Open Long long | BullMAPlus and AroonHitUp | On | 867 |
| Open Short short | BearMAPlus and AroonHitDown | On | 869 |
| Open Long long | macdTPl and AroonHitUp | On | 872 |
| Open Short short | macdTPs and AroonHitDown | On | 874 |
| Open Long long | (macdTPl and AroonHitUp) or (MACDBull and AroonHitUp) | On | 877 |
| Open Short short | (macdTPs and AroonHitDown) or (MACDBear and AroonHitDown) | On | 879 |
| Open Long long | (MACDBull and AroonHitUp) | On | 882 |
| Open Short short | (MACDBear and AroonHitDown) | On | 884 |
| Open Long long | ATRLCondition and AroonHitUp | On | 887 |
| Open Short short | ATRSCondition and AroonHitDown | On | 889 |
| Open Long long | LongRepeat and AroonHitUp | On | 892 |
| Open Short short | ShortRepeat and AroonHitDown | On | 894 |
| Open Long long | LongRepeat and AroonHitUp and L_Consecutive | On | 897 |
| Open Short short | ShortRepeat and AroonHitDown and S_Consecutive | On | 899 |
| Open Long long | AroonHitUp | On | 902 |
| Open Short short | AroonHitDown | On | 904 |
| Open Long long | not na(close[lengthBO]) | On | 908 |
| Open Short short | BreakOut_MODE == true | On | 909 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) | On | 912 |
| Open Short short | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) | On | 914 |
| Open Long long | (longCondition15) | On | 917 |
| Close 15m BREAK DOWN | (shortCondition15) | On | 920 |
| Open Long long | BullMACross | On | 924 |
| Open Short short | BearMACross | On | 926 |
| Open Long long | BullMAPlus | On | 929 |
| Open Short short | BearMAPlus | On | 931 |
| Open Long long | macdTPl | On | 934 |
| Open Short short | macdTPs | On | 936 |
| Open Long long | macdTPl or MACDBull | On | 939 |
| Open Short short | macdTPs or MACDBear | On | 941 |
| Open Long long | MACDBull | On | 944 |
| Open Short short | MACDBear | On | 946 |
| Open Long long | ATRLCondition | On | 949 |
| Open Short short | ATRSCondition | On | 951 |
| Open Long long | LongRepeat | On | 954 |
| Open Short short | ShortRepeat | On | 956 |
| Open Long long | LongRepeat and L_Consecutive | On | 959 |
| Open Short short | ShortRepeat and S_Consecutive | On | 961 |
| Open Long long | Forex_mode == true | On | 963 |
| Open Short short | Forex_mode == true | On | 964 |
| Open Long long | not na(close[lengthBO]) and MACDBull | On | 969 |
| Close | MACDBear | On | 971 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and MACDBull | On | 974 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and MACDBear | On | 976 |
| Open Long long | (longCondition15) and MACDBull | On | 979 |
| Close 15m BREAK DOWN | (shortCondition15) and MACDBear | On | 982 |
| Open Long long | BullMACross and MACDBull | On | 986 |
| Close | BearMACross and MACDBear | On | 988 |
| Open Long long | BullMAPlus and MACDBull | On | 991 |
| Close | BearMAPlus and MACDBear | On | 993 |
| Open Long long | macdTPl | On | 996 |
| Close | macdTPs | On | 998 |
| Open Long long | macdTPl or MACDBull | On | 1001 |
| Close | macdTPs or MACDBear | On | 1003 |
| Open Long long | MACDBull | On | 1006 |
| Close | MACDBear | On | 1008 |
| Open Long long | ATRLCondition and MACDBull | On | 1011 |
| Close | ATRSCondition and MACDBear | On | 1013 |
| Open Long long | LongRepeat and MACDBull | On | 1016 |
| Close | ShortRepeat and MACDBear | On | 1018 |
| Open Long long | LongRepeat and MACDBull and L_Consecutive | On | 1021 |
| Close | ShortRepeat and MACDBear and S_Consecutive | On | 1023 |
| Open Long long | MACDBull | On | 1026 |
| Exit Exit_LFX stop | MACDBear | On | 1028 |
| Open Long long | not na(close[lengthBO]) and BULLRSI | On | 1032 |
| Close | BEARRSI | On | 1034 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BULLRSI | On | 1037 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BEARRSI | On | 1039 |
| Open Long long | (longCondition15) and BULLRSI | On | 1042 |
| Close 15m BREAK DOWN | (shortCondition15) and BEARRSI | On | 1045 |
| Open Long long | BullMACross and BULLRSI | On | 1049 |
| Close | BearMACross and BEARRSI | On | 1051 |
| Open Long long | BullMAPlus and BULLRSI | On | 1054 |
| Close | BearMAPlus and BEARRSI | On | 1056 |
| Open Long long | macdTPl and BULLRSI | On | 1059 |
| Close | macdTPs and BEARRSI | On | 1061 |
| Open Long long | (macdTPl and BULLRSI) or (MACDBull and BULLRSI) | On | 1064 |
| Close | (macdTPs and BEARRSI) or (MACDBear and BEARRSI) | On | 1066 |
| Open Long long | (MACDBull and BULLRSI) | On | 1069 |
| Close | (MACDBear and BEARRSI) | On | 1071 |
| Open Long long | ATRLCondition and BULLRSI | On | 1074 |
| Close | ATRSCondition and BEARRSI | On | 1076 |
| Open Long long | LongRepeat and BULLRSI | On | 1079 |
| Close | ShortRepeat and BEARRSI | On | 1081 |
| Open Long long | LongRepeat and BULLRSI and L_Consecutive | On | 1084 |
| Close | ShortRepeat and BEARRSI and S_Consecutive | On | 1086 |
| Open Long long | BULLRSI | On | 1089 |
| Exit Exit_LFX stop | BEARRSI | On | 1091 |
| Open Long long | not na(close[lengthBO]) and BullMAPlus | On | 1095 |
| Close | BearMAPlus | On | 1097 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and BullMAPlus | On | 1100 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and BearMAPlus | On | 1102 |
| Open Long long | (longCondition15) and BullMAPlus | On | 1105 |
| Close 15m BREAK DOWN | (shortCondition15) and BearMAPlus | On | 1108 |
| Open Long long | macdTPl and BullMAPlus | On | 1112 |
| Close | macdTPs and BearMAPlus | On | 1114 |
| Open Long long | (macdTPl and BullMAPlus) or (MACDBull and BullMAPlus) | On | 1117 |
| Close | (macdTPs and BearMAPlus) or (MACDBear and BearMAPlus) | On | 1119 |
| Open Long long | (MACDBull and BullMAPlus) | On | 1122 |
| Close | (MACDBear and BearMAPlus) | On | 1124 |
| Open Long long | BullMACross | On | 1127 |
| Close | BearMACross | On | 1129 |
| Open Long long | BullMAPlus | On | 1132 |
| Close | BearMAPlus | On | 1134 |
| Open Long long | ATRLCondition and BullMAPlus | On | 1137 |
| Close | ATRSCondition and BearMAPlus | On | 1139 |
| Open Long long | LongRepeat and BullMAPlus | On | 1142 |
| Close | ShortRepeat and BearMAPlus | On | 1144 |
| Open Long long | LongRepeat and BullMAPlus and L_Consecutive | On | 1147 |
| Close | ShortRepeat and BearMAPlus and S_Consecutive | On | 1149 |
| Open Long long | BullMAPlus | On | 1152 |
| Exit Exit_LFX stop | BearMAPlus | On | 1154 |
| Open Long long | not na(close[lengthBO]) and ichi_bullplus | On | 1158 |
| Close | ichi_bearplus | On | 1160 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and ichi_bullplus | On | 1163 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and ichi_bearplus | On | 1165 |
| Open Long long | (longCondition15) and ichi_bullplus | On | 1168 |
| Close 15m BREAK DOWN | (shortCondition15) and ichi_bearplus | On | 1171 |
| Open Long long | BullMACross and ichi_bullplus | On | 1175 |
| Close | BearMACross and ichi_bearplus | On | 1177 |
| Open Long long | BullMAPlus and ichi_bullplus | On | 1180 |
| Close | BearMAPlus and ichi_bearplus | On | 1182 |
| Open Long long | macdTPl and ichi_bullplus | On | 1185 |
| Close | macdTPs and ichi_bearplus | On | 1187 |
| Open Long long | (macdTPl and ichi_bullplus) or (MACDBull and ichi_bullplus) | On | 1190 |
| Close | (macdTPs and ichi_bearplus) or (MACDBear and ichi_bearplus) | On | 1192 |
| Open Long long | (MACDBull and ichi_bullplus) | On | 1195 |
| Close | (MACDBear and ichi_bearplus) | On | 1197 |
| Open Long long | ATRLCondition and ichi_bullplus | On | 1200 |
| Close | ATRSCondition and ichi_bearplus | On | 1202 |
| Open Long long | LongRepeat and ichi_bullplus | On | 1205 |
| Close | ShortRepeat and ichi_bearplus | On | 1207 |
| Open Long long | LongRepeat and ichi_bullplus and L_Consecutive | On | 1210 |
| Close | ShortRepeat and ichi_bearplus and S_Consecutive | On | 1212 |
| Open Long long | ichi_bullplus | On | 1215 |
| Exit Exit_LFX stop | ichi_bearplus | On | 1217 |
| Open Long long | not na(close[lengthBO]) and AroonHitUp | On | 1221 |
| Close | AroonHitDown | On | 1223 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) and AroonHitUp | On | 1226 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) and AroonHitDown | On | 1228 |
| Open Long long | (longCondition15) and AroonHitUp | On | 1231 |
| Close 15m BREAK DOWN | (shortCondition15) and AroonHitDown | On | 1234 |
| Open Long long | BullMACross and AroonHitUp | On | 1238 |
| Close | BearMACross and AroonHitDown | On | 1240 |
| Open Long long | BullMAPlus and AroonHitUp | On | 1243 |
| Close | BearMAPlus and AroonHitDown | On | 1245 |
| Open Long long | macdTPl and AroonHitUp | On | 1248 |
| Close | macdTPs and AroonHitDown | On | 1250 |
| Open Long long | (macdTPl and AroonHitUp) or (MACDBull and AroonHitUp) | On | 1253 |
| Close | (macdTPs and AroonHitDown) or (MACDBear and AroonHitDown) | On | 1255 |
| Open Long long | (MACDBull and AroonHitUp) | On | 1258 |
| Close | (MACDBear and AroonHitDown) | On | 1260 |
| Open Long long | ATRLCondition and AroonHitUp | On | 1263 |
| Close | ATRSCondition and AroonHitDown | On | 1265 |
| Open Long long | LongRepeat and AroonHitUp | On | 1268 |
| Close | ShortRepeat and AroonHitDown | On | 1270 |
| Open Long long | LongRepeat and AroonHitUp and L_Consecutive | On | 1273 |
| Close | ShortRepeat and AroonHitDown and S_Consecutive | On | 1275 |
| Open Long long | AroonHitUp | On | 1278 |
| Exit Exit_LFX stop | AroonHitDown | On | 1280 |
| Open Long long | not na(close[lengthBO]) | On | 1284 |
| Exit Long stop | BreakOut_MODE == true | On | 1285 |
| Open Long long | (Consecutive_MODE ? ups >= consecutiveBarsUp : na) | On | 1288 |
| Close | (Consecutive_MODE ? dns >= consecutiveBarsDown : na) | On | 1290 |
| Open Long long | (longCondition15) | On | 1293 |
| Close 15m BREAK DOWN | (shortCondition15) | On | 1296 |
| Open Long long | BullMACross | On | 1300 |
| Close | BearMACross | On | 1302 |
| Open Long long | BullMAPlus | On | 1305 |
| Close | BearMAPlus | On | 1307 |
| Open Long long | macdTPl | On | 1310 |
| Close | macdTPs | On | 1312 |
| Open Long long | macdTPl or MACDBull | On | 1315 |
| Close | macdTPs or MACDBear | On | 1317 |
| Open Long long | MACDBull | On | 1320 |
| Close | MACDBear | On | 1322 |
| Open Long long | ATRLCondition | On | 1325 |
| Close | ATRSCondition | On | 1327 |
| Open Long long | LongRepeat | On | 1330 |
| Close | ShortRepeat | On | 1332 |
| Open Long long | LongRepeat and L_Consecutive | On | 1335 |
| Close | ShortRepeat and S_Consecutive | On | 1337 |
| Open Long long | Forex_mode == true | On | 1339 |
| Exit Spot_ExitFX stop | Forex_mode == true | On | 1340 |
| Exit Exit stop and limit | strategy.position_size > 0 | On | 1390 |
| Exit Exit stop and limit | strategy.position_size < 0 | On | 1392 |
| Exit Exit stop and limit | strategy.position_size > 0 | On | 1395 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| (no title) | alert | 15m BREAK UP | 604 |
| (no title) | alert | 15m BREAK DOWN | 607 |
| (no title) | alert | 15m BREAK UP | 667 |
| (no title) | alert | 15m BREAK DOWN | 670 |
| (no title) | alert | 15m BREAK UP | 730 |
| (no title) | alert | 15m BREAK DOWN | 733 |
| (no title) | alert | 15m BREAK UP | 793 |
| (no title) | alert | 15m BREAK DOWN | 796 |
| (no title) | alert | 15m BREAK UP | 856 |
| (no title) | alert | 15m BREAK DOWN | 859 |
| (no title) | alert | 15m BREAK UP | 918 |
| (no title) | alert | 15m BREAK DOWN | 921 |
| (no title) | alert | 15m BREAK UP | 980 |
| (no title) | alert | 15m BREAK DOWN | 983 |
| (no title) | alert | 15m BREAK UP | 1043 |
| (no title) | alert | 15m BREAK DOWN | 1046 |
| (no title) | alert | 15m BREAK UP | 1106 |
| (no title) | alert | 15m BREAK DOWN | 1109 |
| (no title) | alert | 15m BREAK UP | 1169 |
| (no title) | alert | 15m BREAK DOWN | 1172 |
| (no title) | alert | 15m BREAK UP | 1232 |
| (no title) | alert | 15m BREAK DOWN | 1235 |
| (no title) | alert | 15m BREAK UP | 1294 |
| (no title) | alert | 15m BREAK DOWN | 1297 |
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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| HAERI 𝐍𝐄𝐓𝐖𝐎𝐑𝐊 by ahhanegin | ema wma rsi pivotlow pivothigh sma highest lowest stdev atr rma highestbars lowestbars | v4 strategy | does not run in Zeal Terminal | ||
| Multi MA Trend Following Strategy Template by TradeAutomation | ema hma rma sma vwma wma stdev atr highest lowest | v5 strategy | +12.3% | 3 | 26.9% |
| TICK Scalping strategy, SPY 1 min by PtGambler | rma ema wma sma pivotlow pivothigh rsi lowest highest | v5 strategy | No trades on this market | ||
| Multi Trend Cross Strategy Template by TradeAutomation | ema hma rma sma vwma wma stdev highest lowest | v5 strategy | +33.0% | 3 | 7.3% |
| VuManChu Cipher B + Divergences Strategy by nattichai001 | ema cross lowest highest rsi sma rma wma | v4 strategy | +76.6% | 175 | 18.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 verifiedThe 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
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library X4815162342/X48_LibaryStrategyStatus/2, whose source is not available here, so it does not run here | Not measured | |
| PineTS | Not tested | Not tested | Not 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 )