Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

ATR GOD Strategy by TradeSmart (PineConnector-compatible)

A Pine Script v5 strategy built on ATR (20), TR (true) and Lowest (50). It has 11 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 111 settings; defaults include Long: Supertrend 1 has to be in uptrend, Short: Supertrend 1 has to be in downtrend and ATR Period 1 20.

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 ATR GOD Strategy by TradeSmart (PineConnector-compatible) repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did ATR GOD Strategy by TradeSmart (PineConnector-compatible) do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Does ATR GOD Strategy by TradeSmart (PineConnector-compatible) run in Pine Script v6?
Yes
Same 4 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
Does ATR GOD Strategy by TradeSmart (PineConnector-compatible) use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does ATR GOD Strategy by TradeSmart (PineConnector-compatible) run in Zeal Terminal?
Yes
It compiles in 212 ms and runs 1,000 bars in 535 ms, in the browser.

BTCUSDT · 1D · default settings

  • Up Trend 1
  • Down Trend 1
  • Up Trend 2
  • Down Trend 2
  • Up Trend 3
  • Down Trend 3
  • Up Trend 4
  • Down Trend 4
  • atrlim_val
  • Long Trend Filter 1
  • Short Trend Filter 1
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (111)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$10,000$20,253Equity from $10,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 421, 424, 425, 428, 431, 432) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

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

Review

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

  • Check

    No stop loss

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

  • Check

    No commission

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    11 settings have no label

    In the settings dialog force_exit_exact_time_1 (line 157), force_exit_exact_time_2 (line 160), force_exit_exact_time_3 (line 163), force_exit_exact_time_4 (line 166), order_size_type (line 172), limit_day1 (line 334), valid_hours1 (line 336), limit_day2 (line 338), valid_hours2 (line 340), limit_day3 (line 342), valid_hours3 (line 344) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

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

Settings

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

SettingDefaultType and rangeFeeds
Plot Settings
Plot SignalsShow Long and Short signals on the signal candle, besides the actual entry points of the strategy.trueboolplotshape
Plot SL/TP LinestrueboolLong Exit Price Long Stop Price Short Exit Price Short Stop Price
Supertrend 1
Plot Supertrend 1falseboolUp Trend 1 Down Trend 1 Start Up Trend 1 Buy 1 Start Down Trend 1 Sell 1
Supertrend 1 can be entry signalThis Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.trueboolcan_be_entry_signal_arr
Long: Supertrend 1 has to be inWhen checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).uptrendstring · options ["uptrend", "downtrend", "unspecified"]long_trend_arr
Short: Supertrend 1 has to be inWhen checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).downtrendstring · options ["uptrend", "downtrend", "unspecified"]short_trend_arr
ATR Period 120intatr_st_1
Source 1hl2sourceup_st_1 dn_st_1
ATR Multiplier 12.0float · step 0.1up_st_1 dn_st_1
Supertrend 2
Plot Supertrend 2falseboolUp Trend 2 Down Trend 2 Start Up Trend 2 Buy 2 Start Down Trend 2 Sell 2
Supertrend 2 can be entry signalThis Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.falseboolcan_be_entry_signal_arr
Long: Supertrend 2 has to be inWhen checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).uptrendstring · options ["uptrend", "downtrend", "unspecified"]long_trend_arr
Short: Supertrend 2 has to be inWhen checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).downtrendstring · options ["uptrend", "downtrend", "unspecified"]short_trend_arr
ATR Period 25intatr_st_2
Source 2hlcc4sourceup_st_2 dn_st_2
ATR Multiplier 215float · step 0.1up_st_2 dn_st_2
Supertrend 3
Plot Supertrend 3falseboolUp Trend 3 Down Trend 3 Start Up Trend 3 Buy 3 Start Down Trend 3 Sell 3
Supertrend 3 can be entry signalThis Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.trueboolcan_be_entry_signal_arr
Long: Supertrend 3 has to be inWhen checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).uptrendstring · options ["uptrend", "downtrend", "unspecified"]long_trend_arr
Short: Supertrend 3 has to be inWhen checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).downtrendstring · options ["uptrend", "downtrend", "unspecified"]short_trend_arr
ATR Period 310intatr_st_3
Source 3hl2sourceup_st_3 dn_st_3
ATR Multiplier 33.0float · step 0.1up_st_3 dn_st_3
Supertrend 4
Plot Supertrend 4falseboolUp Trend 4 Down Trend 4 Start Up Trend 4 Buy 4 Start Down Trend 4 Sell 4
Supertrend 4 can be entry signalThis Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.trueboolcan_be_entry_signal_arr
Long: Supertrend 4 has to be inWhen checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).uptrendstring · options ["uptrend", "downtrend", "unspecified"]long_trend_arr
Short: Supertrend 4 has to be inWhen checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).downtrendstring · options ["uptrend", "downtrend", "unspecified"]short_trend_arr
ATR Period 420intatr_st_4
Source 4hl2sourceup_st_4 dn_st_4
ATR Multiplier 410.0float · step 0.1up_st_4 dn_st_4
Exit Strategy
ATR Based Stop LossPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.trueboolb_atr_buy b_atr_sell s_atr_buy s_atr_sell line 416
ATR Length100intnnatr
ATR SmoothingRMA/SMMAstring · options ["RMA/SMMA", "SMA", "EMA", "WMA"]nnatr line 116 line 119 line 122
Candle Low/High Based Stop LossUse recent lowest or highest point (depending on long/short position) to calculate stop loss value.\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.falseboolb_atr_buy b_atr_sell s_atr_buy s_atr_sell line 416
Candle Lookback50intlowest_point_sl highest_point_sl
Percentage Based Stop LossSet the stop loss to current price - % of current price (long) or price + % of current price (short).\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.falseboolb_atr_buy b_atr_sell s_atr_buy s_atr_sell
Percentage0.3floatpercentage_val
Pip Based Stop LossSet the stop loss to current price - x pips (long) or price + x pips (short).\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.falseboolb_atr_buy b_atr_sell s_atr_buy s_atr_sell
Pip10intpip_long_sl pip_short_sl
Base Risk Multiplier4.5float · min 0.1 · step 0.1nnatr_profit percentage_long_sl percentage_short_sl b_atr_buy b_atr_sell s_atr_buy s_atr_sell
Risk to Reward Ratio1.5float · min 0.1 · step 0.1nnatr_profit
Force Exiting
1 - Force exit on custom session closefalseboolline 433
Force exit exact time 1 (no label in the script)If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!0930-1630:1234567sessioncustom_session_1
2 - Force exit on custom session closefalseboolline 434
Force exit exact time 2 (no label in the script)If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!0930-1630:1234567sessioncustom_session_2
3 - Force exit on custom session closefalseboolline 435
Force exit exact time 3 (no label in the script)If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!0930-1630:1234567sessioncustom_session_3
4 - Force exit on custom session closefalseboolline 436
Force exit exact time 4 (no label in the script)If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!0930-1630:1234567sessioncustom_session_4
Base Setups
Allow Long Entriestrueboollong line 419
Allow Short Entriestrueboolshort line 426
Order Size1000float · min 0ourQty
Order size type (no label in the script)Adjust how the position size is calculated:\n\nCash: only the set cash ammount will be used for each trade\n\nContract(s): the adjusted number of contracts will be used for each trade\n\nCapital Percentage: a % of the current available capital will be used for each tradeCashstring · options ["Cash", "Contract(s)", "Capital Percentage"]ourQty
ATR Limiter
Use ATR LimiterOnly enter into any position (long/short) if ATR value is higher than the Low Boundary and lower than the High Boundary.trueboolline 195 line 198
ATR Limiter Length50intatrlim_val
ATR Limiter SmoothingRMA/SMMAstring · options ["RMA/SMMA", "SMA", "EMA", "WMA"]atrlim_val
High Boundary1000floatline 195 line 198
Low Boundary0.0003floatline 195 line 198
MA based calculationIf not Unspecified, an MA is calculated with the ATR value as source. Only enter into position (long/short) if ATR value is higher/lower than the MA.ATR value under MAstring · options ["ATR value over MA", "ATR value under MA", "Unspecified"]line 195 line 198
MA TypeRMA/SMMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]atrlim_ema
MA Length400int · min 1atrlim_ema
Waddah Attar Filter
Explosion/Deadzone relationExplosion over Deadzone: trades will only happen if the explosion line is over the deadzone line;\n\nExplosion under Deadzone: trades will only happen if the explosion line is under the deadzone line;\n\nNot specified: the opening of trades will not be based on the relation between the explosion and deadzone lines.Not specifiedstring · options ["Explosion over Deadzone", "Explosion under Deadzone", "Not specified"]logic
Limit trades based on trendsStrong Trends: only enter long if the WA bar is colored green (there is an uptrend and the current bar is higher then the previous); only enter short if the WA bar is colored red (there is a downtrend and the current bar is higher then the previous);\n\nSoft Trends: only enter long if the WA bar is colored lime (there is an uptrend and the current bar is lower then the previous); only enter short if the WA bar is colored orange (there is a downtrend and the current bar is lower then the previous);\n\nAll Trends: only enter long if the WA bar is colored green or lime (there is an uptrend); only enter short if the WA bar is colored red or orange (there is a downtrend);\n\nNot specified: the color of the WA bar (trend) is not relevant when considering entries.Not specifiedstring · options ["Strong Trends", "Soft Trends", "All Trends", "Not specified"]trend
WA bar valueOver Explosion and Deadzone: only enter trades when the WA bar value is over the Explosion and Deadzone lines;\n\nNot specified: the relation between the explosion/deadzone lines to the value of the WA bar will not be used to filter opening trades.Not specifiedstring · options ["Over Explosion and Deadzone", "Not specified"]wa_bar_value
Sensitivity150intwafilt_t1
Fast MA TypeSMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]wafilt_t1
Fast MA Length10intwafilt_t1
Slow MA TypeSMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]wafilt_t1
Slow MA Length20intwafilt_t1
Channel MA TypeEMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]wafilt_e1
BB Channel Length20intwafilt_e1
BB Stdev Multiplier2.0floatwafilt_e1
Trend Filter
Use long trend filter 1Only enter long if price is above Long MA.falseboollong_filter_1
Show long trend filter 1Plot the selected MA on the chart.falseboolLong Trend Filter 1
TF1 - MA TypeEMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]long_ma_tf_1
TF1 - MA Length120intlong_ma_tf_1
TF1 - MA Sourceclosesourcelong_ma_tf_1
Use short trend filter 1Only enter short if price is under Short MA.falseboolshort_filter_1
Show short trend filter 1Plot the selected MA on the chart.falseboolShort Trend Filter 1
TF2 - MA TypeEMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]short_ma_tf_1
TF2 - MA Length120intshort_ma_tf_1
TF2 - MA Sourceclosesourceshort_ma_tf_1
Volume Filter
Only enter trades where volume is higher then the volume-based MAA set type of MA will be calculated with the volume as source, and set lengthtrueboolline 311
Volume-based MA TypeRMA/SMMAstring · options ["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"]vol_ma
Volume-based MA Length200intvol_ma
Date Range Limiter
Limit Between Datesfalseboolshould_long_limit_dates should_short_limit_dates
Start Datetimestamp("Jan 01 2023 00:00:00")timeline 356
End Datetimestamp("Jun 24 2023 00:00:00")timeline 356
Session Limiter
Show session plotsShow crypto market sessions on chart: Sidney (red), Tokyo (orange), London (yellow), New York (green)falseboolSydney Session Tokyo Session London Session New York Session
Use session limiterIf enabled, trades will only happen in the ticked sessions below.falseboolline 363
Sidney sessionSession between: 15:00 - 00:00 (EST)falsebools1
Tokyo sessionSession between: 19:00 - 04:00 (EST)falsebools2
London sessionSession between: 03:00 - 11:00 (EST)falsebools3
New York sessionSession between: 08:00 - 17:00 (EST)falsebools4
Trading Time Limiter
Limit Trading TimeTick this together with the options below to enable limiting based on day and time.trueboolshould_long_limit_day_trades should_short_limit_day_trades
Valid Trading Days GlobalIf the Limit Trading Time is on, trades will only happen on days that are present in this field. If any of the not global Valid Trading Days is used, this field will be neglected.\n\nValues represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\nTo trade on all days use: 123457123567stringt t7 t8 t9
Limit day1 (no label in the script)falseboolt t7 t1
(1) Valid Trading DaysValues represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (1) Valid Trading Hours Between is checked.23456stringt1
Valid hours1 (no label in the script)Hours between which the trades can happen. The time is always in the exchange's timezone.falseboolt7 t1
(1) Valid Trading Hours Between1800-2000sessiont7 t1
Limit day2 (no label in the script)falseboolt t8 t2
(2) Valid Trading DaysValues represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (2) Valid Trading Hours Between is checked.1234567stringt2
Valid hours2 (no label in the script)Hours between which the trades can happen. The time is always in the exchange's timezone.falseboolt8 t2
(2) Valid Trading Hours Between0930-1600sessiont8 t2
Limit day3 (no label in the script)falseboolt t9 t3
(3) Valid Trading DaysValues represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (3) Valid Trading Hours Between is checked.1234567stringt3
Valid hours3 (no label in the script)Hours between which the trades can happen. The time is always in the exchange's timezone.falseboolt9 t3
(3) Valid Trading Hours Between0930-1600sessiont9 t3
PineConnector Automation
Use PineConnector Automation | PLEASE READ TOOLTIP -->NOTE! In order for the connection to MetaTrader to work, you will need do perform prerequisite steps, you can follow our full guide at our website, or refer to the official PineConnector Documentation.\n\nTo set up PineConnector Automation on the TradingView side, you will need to do the following:\n\n1. Fill out the License ID field with your PineConnector License ID;\n\n2. Fill out the Risk (trading volume) with the desired volume to be traded in each trade (the meaning of this value depends on the EA settings in Metatrader. Follow the detailed guide for additional information);\n\n3. After filling out the fields, you need to enable the 'Use PineConnector Automation' option (check the box in the strategy settings);\n\n4. Check if the chart has updated and you can see the appropriate order comments on your chart;\n\n5. Create an alert with the strategy selected as Condition, and the Message as {{strategy.order.comment}} (should be there by default);\n\n6. Enable the Webhook URL in the Notifications section, set it as the official PineConnector webhook address and enjoy your connection with MetaTrader.falseboolclose_all close_all line 409 order Long Entry order Long Exit order Long Stop order Short Entry order Short Exit order Short Stop
License ID60123456789int · max 9999999999999pc_long_entry_alert pc_short_entry_alert pc_long_exit_alert pc_short_exit_alert
Risk (trading volume)1floatpc_long_entry_alert pc_short_entry_alert pc_long_exit_alert pc_short_exit_alert

What it calculates

  • ATRATR Period 1 (20)atr_st_1 · line 18
  • ATRATR Period 2 (5)atr_st_2 · line 44
  • ATRATR Period 3 (10)atr_st_3 · line 70
  • ATRATR Period 4 (20)atr_st_4 · line 96
  • TRtrue · chosen by ATR Smoothingnnatr · line 143
  • LowestCandle Lookback (50)lowest_point_sl · line 144
  • HighestCandle Lookback (50)highest_point_sl · line 145
  • SMA / EMA / WMA / VWMA / RMA / SWMA / HMAmaSrc, maLenmaOut · line 175
  • TRtrue · chosen by ATR Limiter Smoothingatrlim_val · line 188
  • Stdevsource, lengthdev · line 251
  • RMA / TRta.tr(true), 100wafilt_dead_zone · line 265

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

Order rules

OrderFires whenBy defaultLine
cancel_all exit_triggerOn408
Close use_pc_automationOff “Use PineConnector Automation | PLEASE READ TOOLTIP -->”410
Close use_pc_automationOff “Use PineConnector Automation | PLEASE READ TOOLTIP -->”412
order Long Entry longlong and strategy.position_size == 0On421
cancel Long Entrystrategy.position_size > 0On423
order Long Exit shortstrategy.position_size > 0On424
order Long Stop shortstrategy.position_size > 0On425
order Short Entry shortshort and strategy.position_size == 0On428
cancel Short Entrystrategy.position_size < 0On430
order Short Exit longstrategy.position_size < 0On431
order Short Stop longstrategy.position_size < 0On432

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

Does it repaint?

No

No repainting patterns in the source.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

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

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.8%+5.5%425%0.390.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+3.5%+9.8%1100%—0.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.9%+8.4%1100%—0.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−6.6%+16.7%20%0.006.6%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.0%+148.3%250%0.982.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.5%+17.1%1100%—0.0%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Similar scripts

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

ScriptSharesTypeNetTradesMax drawdown
ATR GOD Strategy by TradeSmart (PineConnector-compatible) this page—v5 strategy0.0%00.0%
Multi MA Trend Following Strategy Template by TradeAutomationema hma rma sma vwma wma stdev atr highest lowestv5 strategy+12.3%326.9%
Multi Trend Cross Strategy Template by TradeAutomationema hma rma sma vwma wma stdev highest lowestv5 strategy+33.0%37.3%
[fpemehd] SSL Baseline Strategy by DuDu95ema sma highest lowest stdev tr atrv5 strategy+2.3%713.7%
SSL + Wave Trend Strategy by kevinmck100ema sma highest lowest stdev tr atrv5 strategy−1.0%11.0%
Ultra Moving Average Rating Trend Strategy by exlux99ema wma highest lowest sma rma vwma hmav5 strategy+2.8%52.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.

  • 12 settings use the untyped input() (line 16, 42, 68, 94, 184, 257, 259, 261, 263, 264, 289, 295). 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

VerifiedDownload the v5 script

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

  • Line 16: input() → input.source()
  • Line 42: input() → input.source()
  • Line 68: input() → input.source()
  • Line 94: input() → input.source()
  • Line 184: input() → input.int()
  • Line 257: input() → input.int()
6 more edits
  • Line 259: input() → input.int()
  • Line 261: input() → input.int()
  • Line 263: input() → input.int()
  • Line 264: input() → input.float()
  • Line 289: input() → input.source()
  • Line 295: input() → input.source()
⋯per_st_1 = input.int(20, title="ATR Period 1", group="Supertrend 1")-src_st_1 = input(hl2, title="Source 1", group="Supertrend 1")+src_st_1 = input.source(hl2, title="Source 1", group="Supertrend 1")mult_st_1 = input.float(2.0, title="ATR Multiplier 1", step=0.1, group="Supertrend 1")⋯per_st_2 = input.int(5, title="ATR Period 2", group="Supertrend 2")-src_st_2 = input(hlcc4, title="Source 2", group="Supertrend 2")+src_st_2 = input.source(hlcc4, title="Source 2", group="Supertrend 2")mult_st_2 = input.float(15, title="ATR Multiplier 2", step=0.1, group="Supertrend 2")⋯per_st_3 = input.int(10, title="ATR Period 3", group="Supertrend 3")-src_st_3 = input(hl2, title="Source 3", group="Supertrend 3")+src_st_3 = input.source(hl2, title="Source 3", group="Supertrend 3")mult_st_3 = input.float(3.0, title="ATR Multiplier 3", step=0.1, group="Supertrend 3")⋯per_st_4 = input.int(20, title="ATR Period 4", group="Supertrend 4")-src_st_4 = input(hl2, title="Source 4", group="Supertrend 4")+src_st_4 = input.source(hl2, title="Source 4", group="Supertrend 4")mult_st_4 = input.float(10.0, title="ATR Multiplier 4", step=0.1, group="Supertrend 4")⋯use_atr_limiter = input.bool(true, title="Use ATR Limiter", group="ATR Limiter", tooltip="Only enter into any position (long/short) if ATR value is higher than the Low Boundary and lower than the High Boundary.")-atrlim_len = input(50, title="ATR Limiter Length", group="ATR Limiter")+atrlim_len = input.int(50, title="ATR Limiter Length", group="ATR Limiter")atrlim_smoothing = input.string("RMA/SMMA", title="ATR Limiter Smoothing", options=["RMA/SMMA", "SMA", "EMA", "WMA"], group="ATR Limiter")⋯wa_over_e_dz = input.string("Not specified", options=["Over Explosion and Deadzone", "Not specified"], title="WA bar value", group="Waddah Attar Filter", tooltip="Over Explosion and Deadzone: only enter trades when the WA bar value is over the Explosion and Deadzone lines;\n\nNot specified: the relation between the explosion/deadzone lines to the value of the WA bar will not be used to filter opening trades.")-wafilt_sensitivity = input(150, title="Sensitivity", group="Waddah Attar Filter")+wafilt_sensitivity = input.int(150, title="Sensitivity", group="Waddah Attar Filter")wafilt_fast_type = input.string("SMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Fast MA Type", inline="wa_1", group="Waddah Attar Filter")-wafilt_fast_length=input(10, title="Fast MA Length", inline="wa_1", group="Waddah Attar Filter")+wafilt_fast_length=input.int(10, title="Fast MA Length", inline="wa_1", group="Waddah Attar Filter")wafilt_slow_type = input.string("SMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Slow MA Type", inline="wa_2", group="Waddah Attar Filter")-wafilt_slow_length=input(20, title="Slow MA Length", inline="wa_2", group="Waddah Attar Filter")+wafilt_slow_length=input.int(20, title="Slow MA Length", inline="wa_2", group="Waddah Attar Filter")wafilt_channel_type = input.string("EMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Channel MA Type", group="Waddah Attar Filter")-wafilt_channel_length=input(20, title="BB Channel Length", inline="wa_3", group="Waddah Attar Filter")+wafilt_channel_length=input.int(20, title="BB Channel Length", inline="wa_3", group="Waddah Attar Filter")-wafilt_mult=input(2.0, title="BB Stdev Multiplier", inline="wa_3", group="Waddah Attar Filter")+wafilt_mult=input.float(2.0, title="BB Stdev Multiplier", inline="wa_3", group="Waddah Attar Filter")wafilt_dead_zone = nz(ta.rma(ta.tr(true),100)) * 3.7⋯long_ma_len_1 = input.int(120, title="TF1 - MA Length", inline="lTF1", group="Trend Filter")-long_ma_source_1 = input(close, title="TF1 - MA Source", inline="lTF1", group="Trend Filter")+long_ma_source_1 = input.source(close, title="TF1 - MA Source", inline="lTF1", group="Trend Filter")float long_ma_tf_1 = switch_ma(long_ma_type_1, long_ma_source_1, long_ma_len_1)⋯short_ma_len_1 = input.int(120, title="TF2 - MA Length", inline="sTF1", group="Trend Filter")-short_ma_source_1 = input(close, title="TF2 - MA Source", inline="sTF1", group="Trend Filter")+short_ma_source_1 = input.source(close, title="TF2 - MA Source", inline="sTF1", group="Trend Filter")float short_ma_tf_1 = switch_ma(short_ma_type_1, short_ma_source_1, short_ma_len_1)⋯

Does it run in Pine Script v6?

Yes

Same 4 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

-// @version=5+// @version=6// @strategy_alert_message {{strategy.order.comment}}⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 212 msWith a workaround 1,000 bars in 535 msNot measured
PineTSNot testedNot testedNot measured

Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 421, 424, 425, 428, 431, 432) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

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

Source

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

// @version=5// @strategy_alert_message {{strategy.order.comment}}// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © TradeSmart22strategy(default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, title="ATR GOD Strategy by TradeSmart", overlay=true, initial_capital=10000, precision=8)// PLOT SETTINGSplot_signals = input.bool(true, title="Plot Signals", group="Plot Settings", tooltip="Show Long and Short signals on the signal candle, besides the actual entry points of the strategy.")plot_sl_tp = input.bool(true, title="Plot SL/TP Lines", group="Plot Settings")// STRATEGY SETTINGS// Supertrend 1plot_st_1 = input.bool(false, title="Plot Supertrend 1", group="Supertrend 1")can_be_entry_signal_st_1 = input.bool(true, title="Supertrend 1 can be entry signal", group="Supertrend 1", tooltip="This Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.")long_trend_st_1 = input.string("uptrend", options=["uptrend", "downtrend", "unspecified"], title="Long: Supertrend 1 has to be in", group="Supertrend 1", tooltip="When checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")short_trend_st_1 = input.string("downtrend", options=["uptrend", "downtrend", "unspecified"], title="Short: Supertrend 1 has to be in", group="Supertrend 1", tooltip="When checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")per_st_1 = input.int(20, title="ATR Period 1", group="Supertrend 1")src_st_1 = input(hl2, title="Source 1", group="Supertrend 1")mult_st_1 = input.float(2.0, title="ATR Multiplier 1", step=0.1, group="Supertrend 1")atr_st_1 = ta.atr(per_st_1)up_st_1 = src_st_1 - (mult_st_1 * atr_st_1)up1_st_1 = nz(up_st_1[1], up_st_1)up_st_1 := close[1] > up1_st_1 ? math.max(up_st_1, up1_st_1) : up_st_1dn_st_1 = src_st_1 + (mult_st_1 * atr_st_1)dn1_st_1 = nz(dn_st_1[1], dn_st_1)dn_st_1 := close[1] < dn1_st_1 ? math.min(dn_st_1, dn1_st_1) : dn_st_1trend_st_1 = 1trend_st_1 := nz(trend_st_1[1], trend_st_1)trend_st_1 := trend_st_1 == -1 and close > dn1_st_1 ? 1 : trend_st_1 == 1 and close < up1_st_1 ? -1 : trend_st_1buySignal_st_1 = trend_st_1 == 1 and trend_st_1[1] == -1sellSignal_st_1 = trend_st_1 == -1 and trend_st_1[1] == 1upPlot_st_1 = plot(trend_st_1 == 1 ? up_st_1 : na, title="Up Trend 1", style=plot.style_linebr, linewidth=1, color=color.rgb(20, 100, 20, 10), display=plot_st_1 ? display.all : display.none)plotshape(buySignal_st_1 and plot_st_1 ? up_st_1 : na, title="Start Up Trend 1", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(20, 100, 20, 10))plotshape(buySignal_st_1 and plot_st_1 ? up_st_1 : na, title="Buy 1", text="Buy 1", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.rgb(20, 100, 20, 10), textcolor=color.white)dnPlot_st_1 = plot(trend_st_1 == 1 ? na : dn_st_1, title="Down Trend 1", style=plot.style_linebr, linewidth=1, color=color.rgb(100, 20, 20, 10), display=plot_st_1 ? display.all : display.none)plotshape(sellSignal_st_1 and plot_st_1 ? dn_st_1 : na, title="Start Down Trend 1", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(100, 20, 20, 10))plotshape(sellSignal_st_1 and plot_st_1 ? dn_st_1 : na, title="Sell 1", text="Sell 1", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.rgb(100, 20, 20, 10), textcolor=color.white)// Supertrend 2plot_st_2 = input.bool(false, title="Plot Supertrend 2", group="Supertrend 2")can_be_entry_signal_st_2 = input.bool(false, title="Supertrend 2 can be entry signal", group="Supertrend 2", tooltip="This Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.")long_trend_st_2 = input.string("uptrend", options=["uptrend", "downtrend", "unspecified"], title="Long: Supertrend 2 has to be in", group="Supertrend 2", tooltip="When checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")short_trend_st_2 = input.string("downtrend", options=["uptrend", "downtrend", "unspecified"], title="Short: Supertrend 2 has to be in", group="Supertrend 2", tooltip="When checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")per_st_2 = input.int(5, title="ATR Period 2", group="Supertrend 2")src_st_2 = input(hlcc4, title="Source 2", group="Supertrend 2")mult_st_2 = input.float(15, title="ATR Multiplier 2", step=0.1, group="Supertrend 2")atr_st_2 = ta.atr(per_st_2)up_st_2 = src_st_2 - (mult_st_2 * atr_st_2)up1_st_2 = nz(up_st_2[1], up_st_2)up_st_2 := close[1] > up1_st_2 ? math.max(up_st_2, up1_st_2) : up_st_2dn_st_2 = src_st_2 + (mult_st_2 * atr_st_2)dn1_st_2 = nz(dn_st_2[1], dn_st_2)dn_st_2 := close[1] < dn1_st_2 ? math.min(dn_st_2, dn1_st_2) : dn_st_2trend_st_2 = 1trend_st_2 := nz(trend_st_2[1], trend_st_2)trend_st_2 := trend_st_2 == -1 and close > dn1_st_2 ? 1 : trend_st_2 == 1 and close < up1_st_2 ? -1 : trend_st_2buySignal_st_2 = trend_st_2 == 1 and trend_st_2[1] == -1sellSignal_st_2 = trend_st_2 == -1 and trend_st_2[1] == 1upPlot_st_2 = plot(trend_st_2 == 1 ? up_st_2 : na, title="Up Trend 2", style=plot.style_linebr, linewidth=1, color=color.rgb(40, 100, 40, 10), display=plot_st_2 ? display.all : display.none)plotshape(buySignal_st_2 and plot_st_2 ? up_st_2 : na, title="Start Up Trend 2", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(40, 100, 40, 10))plotshape(buySignal_st_2 and plot_st_2 ? up_st_2 : na, title="Buy 2", text="Buy 2", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.rgb(40, 100, 40, 10), textcolor=color.white)dnPlot_st_2 = plot(trend_st_2 == 1 ? na : dn_st_2, title="Down Trend 2", style=plot.style_linebr, linewidth=1, color=color.rgb(100, 40, 40, 10), display=plot_st_2 ? display.all : display.none)plotshape(sellSignal_st_2 and plot_st_2 ? dn_st_2 : na, title="Start Down Trend 2", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(100, 40, 40, 10))plotshape(sellSignal_st_2 and plot_st_2 ? dn_st_2 : na, title="Sell 2", text="Sell 2", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.rgb(100, 40, 40, 10), textcolor=color.white)// Supertrend 3plot_st_3 = input.bool(false, title="Plot Supertrend 3", group="Supertrend 3")can_be_entry_signal_st_3 = input.bool(true, title="Supertrend 3 can be entry signal", group="Supertrend 3", tooltip="This Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.")long_trend_st_3 = input.string("uptrend", options=["uptrend", "downtrend", "unspecified"], title="Long: Supertrend 3 has to be in", group="Supertrend 3", tooltip="When checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")short_trend_st_3 = input.string("downtrend", options=["uptrend", "downtrend", "unspecified"], title="Short: Supertrend 3 has to be in", group="Supertrend 3", tooltip="When checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")per_st_3 = input.int(10, title="ATR Period 3", group="Supertrend 3")src_st_3 = input(hl2, title="Source 3", group="Supertrend 3")mult_st_3 = input.float(3.0, title="ATR Multiplier 3", step=0.1, group="Supertrend 3")atr_st_3 = ta.atr(per_st_3)up_st_3 = src_st_3 - (mult_st_3 * atr_st_3)up1_st_3 = nz(up_st_3[1], up_st_3)up_st_3 := close[1] > up1_st_3 ? math.max(up_st_3, up1_st_3) : up_st_3dn_st_3 = src_st_3 + (mult_st_3 * atr_st_3)dn1_st_3 = nz(dn_st_3[1], dn_st_3)dn_st_3 := close[1] < dn1_st_3 ? math.min(dn_st_3, dn1_st_3) : dn_st_3trend_st_3 = 1trend_st_3 := nz(trend_st_3[1], trend_st_3)trend_st_3 := trend_st_3 == -1 and close > dn1_st_3 ? 1 : trend_st_3 == 1 and close < up1_st_3 ? -1 : trend_st_3buySignal_st_3 = trend_st_3 == 1 and trend_st_3[1] == -1sellSignal_st_3 = trend_st_3 == -1 and trend_st_3[1] == 1upPlot_st_3 = plot(trend_st_3 == 1 ? up_st_3 : na, title="Up Trend 3", style=plot.style_linebr, linewidth=1, color=color.rgb(60, 100, 60, 10), display=plot_st_3 ? display.all : display.none)plotshape(buySignal_st_3 and plot_st_3 ? up_st_3 : na, title="Start Up Trend 3", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(60, 100, 60, 10))plotshape(buySignal_st_3 and plot_st_3 ? up_st_3 : na, title="Buy 3", text="Buy 3", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.rgb(60, 100, 60, 10), textcolor=color.white)dnPlot_st_3 = plot(trend_st_3 == 1 ? na : dn_st_3, title="Down Trend 3", style=plot.style_linebr, linewidth=1, color=color.rgb(100, 60, 60, 10), display=plot_st_3 ? display.all : display.none)plotshape(sellSignal_st_3 and plot_st_3 ? dn_st_3 : na, title="Start Down Trend 3", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(100, 60, 60, 10))plotshape(sellSignal_st_3 and plot_st_3 ? dn_st_3 : na, title="Sell 3", text="Sell 3", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.rgb(100, 60, 60, 10), textcolor=color.white)// Supertrend 4plot_st_4 = input.bool(false, title="Plot Supertrend 4", group="Supertrend 4")can_be_entry_signal_st_4 = input.bool(true, title="Supertrend 4 can be entry signal", group="Supertrend 4", tooltip="This Supertrend will be checked for a potential entry signal. (meaning Buy for a Long entry and Sell for a Short entry) If disabled, the strategy will not enter on any Buy/Sell signals emitted by this particular Supertrend.\n\nNOTE: One of the Supertrends must be enabled to be a potential entry signal in order for the strategy to enter into any trades.")long_trend_st_4 = input.string("uptrend", options=["uptrend", "downtrend", "unspecified"], title="Long: Supertrend 4 has to be in", group="Supertrend 4", tooltip="When checking for a potential Long entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")short_trend_st_4 = input.string("downtrend", options=["uptrend", "downtrend", "unspecified"], title="Short: Supertrend 4 has to be in", group="Supertrend 4", tooltip="When checking for a potential Short entry signal, this particular Supertrend must be in the set trend or undefined (meaning that it can be in either up/down trends).")per_st_4 = input.int(20, title="ATR Period 4", group="Supertrend 4")src_st_4 = input(hl2, title="Source 4", group="Supertrend 4")mult_st_4 = input.float(10.0, title="ATR Multiplier 4", step=0.1, group="Supertrend 4")atr_st_4 = ta.atr(per_st_4)up_st_4 = src_st_4 - (mult_st_4 * atr_st_4)up1_st_4 = nz(up_st_4[1], up_st_4)up_st_4 := close[1] > up1_st_4 ? math.max(up_st_4, up1_st_4) : up_st_4dn_st_4 = src_st_4 + (mult_st_4 * atr_st_4)dn1_st_4 = nz(dn_st_4[1], dn_st_4)dn_st_4 := close[1] < dn1_st_4 ? math.min(dn_st_4, dn1_st_4) : dn_st_4trend_st_4 = 1trend_st_4 := nz(trend_st_4[1], trend_st_4)trend_st_4 := trend_st_4 == -1 and close > dn1_st_4 ? 1 : trend_st_4 == 1 and close < up1_st_4 ? -1 : trend_st_4buySignal_st_4 = trend_st_4 == 1 and trend_st_4[1] == -1sellSignal_st_4 = trend_st_4 == -1 and trend_st_4[1] == 1upPlot_st_4 = plot(trend_st_4 == 1 ? up_st_4 : na, title="Up Trend 4", style=plot.style_linebr, linewidth=1, color=color.rgb(0, 100, 100, 10), display=plot_st_4 ? display.all : display.none)plotshape(buySignal_st_4 and plot_st_4 ? up_st_4 : na, title="Start Up Trend 4", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(0, 100, 100, 10))plotshape(buySignal_st_4 and plot_st_4 ? up_st_4 : na, title="Buy 4", text="Buy 4", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.rgb(0, 100, 100, 10), textcolor=color.white)dnPlot_st_4 = plot(trend_st_4 == 1 ? na : dn_st_4, title="Down Trend 4", style=plot.style_linebr, linewidth=1, color=color.rgb(100, 0, 100, 10), display=plot_st_4 ? display.all : display.none)plotshape(sellSignal_st_4 and plot_st_4 ? dn_st_4 : na, title="Start Down Trend 4", location=location.absolute, style=shape.circle, size=size.tiny, color=color.rgb(100, 0, 100, 10))plotshape(sellSignal_st_4 and plot_st_4 ? dn_st_4 : na, title="Sell 4", text="Sell 4", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.rgb(100, 0, 100, 10), textcolor=color.white)// Exit Strategyfunction(source, length, smoothing) =>     if smoothing == "RMA/SMMA"        ta.rma(source, length)    else        if smoothing == "SMA"            ta.sma(source, length)        else            if smoothing == "EMA"                ta.ema(source, length)            else                ta.wma(source, length)formula(number, decimals) =>    factor = math.pow(10, decimals)    int(number * factor) / factor    use_atr_based_sl = input.bool(true, "ATR Based Stop Loss", group="Exit Strategy", tooltip="Please select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.")nnatr_length = input.int(100, title = "ATR Length", group="Exit Strategy")smoothing = input.string("RMA/SMMA", title="ATR Smoothing", options=["RMA/SMMA", "SMA", "EMA", "WMA"], group="Exit Strategy")use_low_high_based_sl = input.bool(false, "Candle Low/High Based Stop Loss", group="Exit Strategy", tooltip="Use recent lowest or highest point (depending on long/short position) to calculate stop loss value.\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.")candle_lookback_sl = input.int(50, title="Candle Lookback", group="Exit Strategy")use_percentage_based_sl = input.bool(false, "Percentage Based Stop Loss", group="Exit Strategy", tooltip="Set the stop loss to current price - % of current price (long) or price + % of current price (short).\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.")percentage_sl = input.float(0.3, title="Percentage", group="Exit Strategy")use_pip_based_sl = input.bool(false, "Pip Based Stop Loss", group="Exit Strategy", tooltip="Set the stop loss to current price - x pips (long) or price + x pips (short).\n\nSet 'Base Risk Multiplier' to 1 if you would like to use the calculated value as is. Setting it to a different value will count as an additional multiplier.\n\nPlease select only one active stop loss. Default value (if nothing or multiple stop losses are selected) is the 'ATR Based Stop Loss'.")pip_sl = input.int(10, title = "Pip", group="Exit Strategy")nnatr_loss = input.float(4.5, title="Base Risk Multiplier", minval = 0.1, step = 0.1, group="Exit Strategy")rr_ratio = input.float(1.5, title="Risk to Reward Ratio", minval = 0.1, step = 0.1, group="Exit Strategy")nnatr_profit = nnatr_loss * rr_ratio    nnatr = formula(function(ta.tr(true), nnatr_length, smoothing), 5)lowest_point_sl = ta.lowest(candle_lookback_sl)highest_point_sl = ta.highest(candle_lookback_sl)percentage_val = percentage_sl * 0.01percentage_long_sl = close - (close * percentage_val * nnatr_loss)percentage_short_sl = close + (close * percentage_val * nnatr_loss)pip_long_sl = close - pip_sl * syminfo.mintickpip_short_sl = close + pip_sl * syminfo.mintickb_atr_buy  = use_atr_based_sl ? close + nnatr * nnatr_profit : use_low_high_based_sl ? close + (close - lowest_point_sl) * nnatr_profit : use_percentage_based_sl ? close + (close - percentage_long_sl) / nnatr_loss * nnatr_profit : use_pip_based_sl ? close + (close - pip_long_sl) * nnatr_profit : close + nnatr * nnatr_profitb_atr_sell = use_atr_based_sl ? close - nnatr * nnatr_loss : use_low_high_based_sl ? lowest_point_sl * nnatr_loss : use_percentage_based_sl ? percentage_long_sl : use_pip_based_sl ? pip_long_sl : close - nnatr * nnatr_losss_atr_buy  = use_atr_based_sl ? close - nnatr * nnatr_profit : use_low_high_based_sl ? close - (highest_point_sl - close) * nnatr_profit : use_percentage_based_sl ? close - (percentage_short_sl - close) / nnatr_loss * nnatr_profit : use_pip_based_sl ? close - (pip_short_sl - close) * nnatr_profit : close - nnatr * nnatr_profits_atr_sell = use_atr_based_sl ? close + nnatr * nnatr_loss : use_low_high_based_sl ? highest_point_sl * nnatr_loss : use_percentage_based_sl ? percentage_short_sl : use_pip_based_sl ? pip_short_sl : close + nnatr * nnatr_loss// FORCE EXITINGuse_force_exit_exact_time_1 = input.bool(false, title="1 - Force exit on custom session close", group="Force Exiting", inline="force_exit_exact_time_1")force_exit_exact_time_1 = input.session("0930-1630:1234567", title="", group="Force Exiting", inline="force_exit_exact_time_1", tooltip="If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!")custom_session_1 = time("30S", force_exit_exact_time_1)use_force_exit_exact_time_2 = input.bool(false, title="2 - Force exit on custom session close", group="Force Exiting", inline="force_exit_exact_time_2")force_exit_exact_time_2 = input.session("0930-1630:1234567", title="", group="Force Exiting", inline="force_exit_exact_time_2", tooltip="If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!")custom_session_2 = time("30S", force_exit_exact_time_2)use_force_exit_exact_time_3 = input.bool(false, title="3 - Force exit on custom session close", group="Force Exiting", inline="force_exit_exact_time_3")force_exit_exact_time_3 = input.session("0930-1630:1234567", title="", group="Force Exiting", inline="force_exit_exact_time_3", tooltip="If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!")custom_session_3 = time("30S", force_exit_exact_time_3)use_force_exit_exact_time_4 = input.bool(false, title="4 - Force exit on custom session close", group="Force Exiting", inline="force_exit_exact_time_4")force_exit_exact_time_4 = input.session("0930-1630:1234567", title="", group="Force Exiting", inline="force_exit_exact_time_4", tooltip="If enabled, trades will close automatically after the set session is closed (on next candle's open). CAUTION: do not set the start and end times of the session to the same value!")custom_session_4 = time("30S", force_exit_exact_time_4)// BASE SETUPSallow_long = input.bool(true, title="Allow Long Entries", group="Base Setups")allow_short = input.bool(true, title="Allow Short Entries", group="Base Setups")order_size_value = input.float(1000, title='Order Size', minval=0, inline="ordersize", group="Base Setups")order_size_type = input.string("Cash", title="", inline="ordersize", options=["Cash", "Contract(s)", "Capital Percentage"], group="Base Setups", tooltip="Adjust how the position size is calculated:\n\nCash: only the set cash ammount will be used for each trade\n\nContract(s): the adjusted number of contracts will be used for each trade\n\nCapital Percentage: a % of the current available capital will be used for each trade")// ATR Filterswitch_ma(maType, maSrc, maLen) =>    float maOut = switch maType        "SMA" => ta.sma(maSrc, maLen)        "EMA" => ta.ema(maSrc, maLen)        "WMA" => ta.wma(maSrc, maLen)        "VWMA" => ta.vwma(maSrc, maLen)        "RMA/SMMA" => ta.rma(maSrc, maLen)        "SWMA" => ta.swma(maSrc)        "HMA" => ta.hma(maSrc, maLen)use_atr_limiter = input.bool(true, title="Use ATR Limiter", group="ATR Limiter", tooltip="Only enter into any position (long/short) if ATR value is higher than the Low Boundary and lower than the High Boundary.")atrlim_len = input(50, title="ATR Limiter Length", group="ATR Limiter")atrlim_smoothing = input.string("RMA/SMMA", title="ATR Limiter Smoothing", options=["RMA/SMMA", "SMA", "EMA", "WMA"], group="ATR Limiter")atrlim_boundary_high = input.float(1000, title="High Boundary", group="ATR Limiter")atrlim_boundary_low = input.float(0.0003, title="Low Boundary", group="ATR Limiter")atrlim_val = formula(function(ta.tr(true), atrlim_len, atrlim_smoothing), 5)plot(atrlim_val, title='atrlim_val', color=color.yellow)atrlim_calc_by_ma = input.string("ATR value under MA", options=["ATR value over MA", "ATR value under MA", "Unspecified"], title="MA based calculation", group="ATR Limiter", tooltip="If not Unspecified, an MA is calculated with the ATR value as source. Only enter into position (long/short) if ATR value is higher/lower than the MA.")atrlim_ema_type = input.string("RMA/SMMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="MA Type", group="ATR Limiter")atrlim_ema_len = input.int(400, title="MA Length", minval=1, group="ATR Limiter")atrlim_ema = switch_ma(atrlim_ema_type, atrlim_val, atrlim_ema_len)check_atr_lim_long() =>    use_atr_limiter ? atrlim_calc_by_ma == "ATR value over MA" ? atrlim_val > atrlim_ema and atrlim_val < atrlim_boundary_high and atrlim_val > atrlim_boundary_low : atrlim_calc_by_ma == "ATR value under MA" ? atrlim_val < atrlim_ema and atrlim_val < atrlim_boundary_high and atrlim_val > atrlim_boundary_low : atrlim_val < atrlim_boundary_high and atrlim_val > atrlim_boundary_low : true    check_atr_lim_short() =>    use_atr_limiter ? atrlim_calc_by_ma == "ATR value over MA" ? atrlim_val > atrlim_ema and atrlim_val > atrlim_boundary_low and atrlim_val < atrlim_boundary_high : atrlim_calc_by_ma == "ATR value under MA" ? atrlim_val < atrlim_ema and atrlim_val > atrlim_boundary_low and atrlim_val < atrlim_boundary_high : atrlim_val > atrlim_boundary_low and atrlim_val < atrlim_boundary_high : true   // Entry Logicgreen_1 = trend_st_1 == 1green_2 = trend_st_2 == 1 green_3 = trend_st_3 == 1 green_4 = trend_st_4 == 1 red_1 = trend_st_1 != 1 red_2 = trend_st_2 != 1red_3 = trend_st_3 != 1red_4 = trend_st_4 != 1st_uptrend_bool_arr = array.from(green_1, green_2, green_3, green_4)st_downtrend_bool_arr = array.from(red_1, red_2, red_3, red_4)st_buy_signal_arr = array.from(buySignal_st_1, buySignal_st_2, buySignal_st_3, buySignal_st_4)last_st_buy_signal_arr = array.from(buySignal_st_1[1], buySignal_st_2[1], buySignal_st_3[1], buySignal_st_4[1])st_sell_signal_arr = array.from(sellSignal_st_1, sellSignal_st_2, sellSignal_st_3, sellSignal_st_4)last_st_sell_signal_arr = array.from(sellSignal_st_1[1], sellSignal_st_2[1], sellSignal_st_3[1], sellSignal_st_4[1])long_trend_arr = array.from(long_trend_st_1, long_trend_st_2, long_trend_st_3, long_trend_st_4)short_trend_arr = array.from(short_trend_st_1, short_trend_st_2, short_trend_st_3, short_trend_st_4)long_trends_ok = trueshort_trends_ok = truefor [index, value] in st_uptrend_bool_arr    if value         if array.get(long_trend_arr, index) == "downtrend"            long_trends_ok := false        if array.get(short_trend_arr, index) == "downtrend"            short_trends_ok := falsefor [index, value] in st_downtrend_bool_arr    if value         if array.get(long_trend_arr, index) == "uptrend"            long_trends_ok := false        if array.get(short_trend_arr, index) == "uptrend"            short_trends_ok := falsecan_be_entry_signal_arr = array.from(can_be_entry_signal_st_1, can_be_entry_signal_st_2, can_be_entry_signal_st_3, can_be_entry_signal_st_4)long_trigger = falseshort_trigger = falsefor [index, value] in st_buy_signal_arr    if array.get(st_buy_signal_arr, index) and not array.get(last_st_buy_signal_arr, index) and array.get(can_be_entry_signal_arr, index)        long_trigger := true    if array.get(st_sell_signal_arr, index) and not array.get(last_st_sell_signal_arr, index) and array.get(can_be_entry_signal_arr, index)        short_trigger := truecheck_entry_long() => long_trigger and long_trends_okcheck_entry_short() => short_trigger and short_trends_ok// WADDAH ATTAR FILTERwafilt_calc_macd(source, fast_length, fast_type, slow_length, slow_type) =>    fast_ma = switch_ma(fast_type, source, fast_length)    slow_ma = switch_ma(slow_type, source, slow_length)    fast_ma - slow_mawafilt_calc_BBUpper(ma_type, source, length, mult) =>    basis = switch_ma(ma_type, source, length)    dev = mult * ta.stdev(source, length)    basis + devwafilt_calc_BBLower(ma_type, source, length, mult) =>     basis = switch_ma(ma_type, source, length)    dev = mult * ta.stdev(source, length)    basis - dev    wa_entry_logic = input.string("Not specified", options=["Explosion over Deadzone", "Explosion under Deadzone", "Not specified"], title="Explosion/Deadzone relation", group="Waddah Attar Filter", tooltip="Explosion over Deadzone: trades will only happen if the explosion line is over the deadzone line;\n\nExplosion under Deadzone: trades will only happen if the explosion line is under the deadzone line;\n\nNot specified: the opening of trades will not be based on the relation between the explosion and deadzone lines.")wafilt_only_trade_when_trend = input.string("Not specified", options=["Strong Trends", "Soft Trends", "All Trends", "Not specified"], title="Limit trades based on trends", group="Waddah Attar Filter", tooltip="Strong Trends: only enter long if the WA bar is colored green (there is an uptrend and the current bar is higher then the previous); only enter short if the WA bar is colored red (there is a downtrend and the current bar is higher then the previous);\n\nSoft Trends: only enter long if the WA bar is colored lime (there is an uptrend and the current bar is lower then the previous); only enter short if the WA bar is colored orange (there is a downtrend and the current bar is lower then the previous);\n\nAll Trends: only enter long if the WA bar is colored green or lime (there is an uptrend); only enter short if the WA bar is colored red or orange (there is a downtrend);\n\nNot specified: the color of the WA bar (trend) is not relevant when considering entries.")wa_over_e_dz = input.string("Not specified", options=["Over Explosion and Deadzone", "Not specified"], title="WA bar value", group="Waddah Attar Filter", tooltip="Over Explosion and Deadzone: only enter trades when the WA bar value is over the Explosion and Deadzone lines;\n\nNot specified: the relation between the explosion/deadzone lines to the value of the WA bar will not be used to filter opening trades.")wafilt_sensitivity = input(150, title="Sensitivity", group="Waddah Attar Filter")wafilt_fast_type = input.string("SMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Fast MA Type", inline="wa_1", group="Waddah Attar Filter")wafilt_fast_length=input(10, title="Fast MA Length", inline="wa_1", group="Waddah Attar Filter")wafilt_slow_type = input.string("SMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Slow MA Type", inline="wa_2", group="Waddah Attar Filter")wafilt_slow_length=input(20, title="Slow MA Length", inline="wa_2", group="Waddah Attar Filter")wafilt_channel_type = input.string("EMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Channel MA Type", group="Waddah Attar Filter")wafilt_channel_length=input(20, title="BB Channel Length", inline="wa_3", group="Waddah Attar Filter")wafilt_mult=input(2.0, title="BB Stdev Multiplier", inline="wa_3", group="Waddah Attar Filter")wafilt_dead_zone = nz(ta.rma(ta.tr(true),100)) * 3.7wafilt_t1 = (wafilt_calc_macd(close, wafilt_fast_length, wafilt_fast_type, wafilt_slow_length, wafilt_slow_type) - wafilt_calc_macd(close[1], wafilt_fast_length, wafilt_fast_type, wafilt_slow_length, wafilt_slow_type)) * wafilt_sensitivitywafilt_e1 = (wafilt_calc_BBUpper(wafilt_channel_type, close, wafilt_channel_length, wafilt_mult) - wafilt_calc_BBLower(wafilt_channel_type, close, wafilt_channel_length, wafilt_mult))wafilt_trend_up = (wafilt_t1 >= 0) ? wafilt_t1 : 0wafilt_trend_down = (wafilt_t1 < 0) ? (-1 * wafilt_t1) : 0wafilt_trend_up_color = wafilt_trend_up < wafilt_trend_up[1] ? color.lime : color.greenwafilt_trend_down_color = wafilt_trend_down < wafilt_trend_down[1] ? color.orange : color.redwafilt_trend_val = wafilt_trend_up != 0 ? wafilt_trend_up : wafilt_trend_downwafilt_trend_color = wafilt_trend_up != 0 ? wafilt_trend_up_color : wafilt_trend_down_colorcheck_waddah_attar_long() =>    logic = wa_entry_logic == "Explosion over Deadzone" ? wafilt_e1 > wafilt_dead_zone : wa_entry_logic == "Explosion under Deadzone" ? wafilt_e1 < wafilt_dead_zone : true    trend = wafilt_only_trade_when_trend == "All Trends" ? wafilt_trend_color == color.lime or wafilt_trend_color == color.green : wafilt_only_trade_when_trend == "Strong Trends" ? wafilt_trend_color == color.green : wafilt_only_trade_when_trend == "Soft Trends" ? wafilt_trend_color == color.lime : true    wa_bar_value = wa_over_e_dz == "Over Explosion and Deadzone" ? wafilt_trend_val > wafilt_e1 and wafilt_trend_val > wafilt_dead_zone : true    logic and trend and wa_bar_valuecheck_waddah_attar_short() =>    logic = wa_entry_logic == "Explosion over Deadzone" ? wafilt_e1 > wafilt_dead_zone : wa_entry_logic == "Explosion under Deadzone" ? wafilt_e1 < wafilt_dead_zone : true    trend = wafilt_only_trade_when_trend == "All Trends" ? wafilt_trend_color == color.red or wafilt_trend_color == color.orange : wafilt_only_trade_when_trend == "Strong Trends" ? wafilt_trend_color == color.red : wafilt_only_trade_when_trend == "Soft Trends" ? wafilt_trend_color == color.orange : true    wa_bar_value = wa_over_e_dz == "Over Explosion and Deadzone" ? wafilt_trend_val > wafilt_e1 and wafilt_trend_val > wafilt_dead_zone : true    logic and trend and wa_bar_value// TREND FILTERuse_long_trend_filter_1 = input.bool(false, title="Use long trend filter 1", group="Trend Filter", tooltip="Only enter long if price is above Long MA.")show_long_trend_filter_1 = input.bool(false, title="Show long trend filter 1", group="Trend Filter", tooltip="Plot the selected MA on the chart.")long_ma_type_1 = input.string("EMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="TF1 - MA Type", inline="lTF1", group="Trend Filter")long_ma_len_1 = input.int(120, title="TF1 - MA Length", inline="lTF1", group="Trend Filter")long_ma_source_1 = input(close, title="TF1 - MA Source", inline="lTF1", group="Trend Filter")float long_ma_tf_1 = switch_ma(long_ma_type_1, long_ma_source_1, long_ma_len_1)use_short_trend_filter_1 = input.bool(false, title="Use short trend filter 1", group="Trend Filter", tooltip="Only enter short if price is under Short MA.")show_short_trend_filter_1 = input.bool(false, title="Show short trend filter 1", group="Trend Filter", tooltip="Plot the selected MA on the chart.")short_ma_type_1 = input.string("EMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="TF2 - MA Type", inline="sTF1", group="Trend Filter")short_ma_len_1 = input.int(120, title="TF2 - MA Length", inline="sTF1", group="Trend Filter")short_ma_source_1 = input(close, title="TF2 - MA Source", inline="sTF1", group="Trend Filter")float short_ma_tf_1 = switch_ma(short_ma_type_1, short_ma_source_1, short_ma_len_1)plot(long_ma_tf_1, color=color.blue, display=show_long_trend_filter_1 ? display.all : display.none, title="Long Trend Filter 1")plot(short_ma_tf_1, color=color.teal, display=show_short_trend_filter_1 ? display.all : display.none, title="Short Trend Filter 1")check_trend_filter_long() =>    long_filter_1 = use_long_trend_filter_1 ? close > long_ma_tf_1 : true    long_filter_1check_trend_filter_short() =>        short_filter_1 = use_short_trend_filter_1 ? close < short_ma_tf_1 : true    short_filter_1// VOLUME FILTERuse_volume_filter = input.bool(true, title="Only enter trades where volume is higher then the volume-based MA", group="Volume Filter", tooltip="A set type of MA will be calculated with the volume as source, and set length")vol_ma_type = input.string("RMA/SMMA", options=["SMA", "EMA", "WMA", "VWMA", "RMA/SMMA", "SWMA", "HMA"], title="Volume-based MA Type", group="Volume Filter")vol_ma_len = input.int(200, title="Volume-based MA Length", group="Volume Filter")vol_ma = switch_ma(vol_ma_type, volume, vol_ma_len)check_volume_filter() =>    use_volume_filter ? volume > vol_ma : true// DATE RANGE SETTINGSlimit_dates = input.bool(false, title="Limit Between Dates", group="Date Range Limiter")start_date = input.time(timestamp("Jan 01 2023 00:00:00"), title="Start Date", group="Date Range Limiter")end_date = input.time(timestamp("Jun 24 2023 00:00:00"), title="End Date", group="Date Range Limiter")// SESSION LIMITERshow_session_plots = input.bool(false, title="Show session plots", group="Session Limiter", tooltip="Show crypto market sessions on chart: Sidney (red), Tokyo (orange), London (yellow), New York (green)")use_session_limit = input.bool(false, title="Use session limiter", group="Session Limiter", tooltip="If enabled, trades will only happen in the ticked sessions below.")limit_session1 = input.bool(false, title="Sidney session", group="Session Limiter", tooltip="Session between: 15:00 - 00:00 (EST)")limit_session2 = input.bool(false, title="Tokyo session", group="Session Limiter", tooltip="Session between: 19:00 - 04:00 (EST)")limit_session3 = input.bool(false, title="London session", group="Session Limiter", tooltip="Session between: 03:00 - 11:00 (EST)")limit_session4 = input.bool(false, title="New York session", group="Session Limiter", tooltip="Session between: 08:00 - 17:00 (EST)")session1 = time(timeframe.period, "1500-0000:1234567", "America/New_York") //Sydney Sessionsession2 = time(timeframe.period, "1900-0400:1234567", "America/New_York") //Tokyo Sessionsession3 = time(timeframe.period, "0300-1100:1234567", "America/New_York") //London Sessionsession4 = time(timeframe.period, "0800-1700:1234567", "America/New_York") //New York Sessionbgcolor(session1 and show_session_plots ? color.new(color.red, 60) : na, title="Sydney Session")bgcolor(session2 and show_session_plots ? color.new(color.orange, 60) : na, title="Tokyo Session")bgcolor(session3 and show_session_plots ? color.new(color.yellow, 60) : na, title="London Session")bgcolor(session4 and show_session_plots ? color.new(color.green, 60) : na, title="New York Session")// TRADING TIMElimit_trading_time = input.bool(true, title="Limit Trading Time", group="Trading Time Limiter", tooltip="Tick this together with the options below to enable limiting based on day and time.")days_to_trade_on = input.string("123567", title="Valid Trading Days Global", tooltip="If the Limit Trading Time is on, trades will only happen on days that are present in this field. If any of the not global Valid Trading Days is used, this field will be neglected.\n\nValues represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\nTo trade on all days use: 123457", group="Trading Time Limiter")limit_day1 = input.bool(false, title="", group="Trading Time Limiter", inline="day1")days_to_trade_on1 = input.string("23456", title="(1) Valid Trading Days", inline="day1", tooltip="Values represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (1) Valid Trading Hours Between is checked.", group="Trading Time Limiter")valid_hours1 = input.bool(false, title="", inline="inline1", group="Trading Time Limiter", tooltip="Hours between which the trades can happen. The time is always in the exchange's timezone.")hours_to_trade_on1 = input.session("1800-2000", title="(1) Valid Trading Hours Between", inline="inline1", group="Trading Time Limiter")limit_day2 = input.bool(false, title="", group="Trading Time Limiter", inline="day2")days_to_trade_on2 = input.string("1234567", title="(2) Valid Trading Days", inline="day2", tooltip="Values represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (2) Valid Trading Hours Between is checked.", group="Trading Time Limiter")valid_hours2 = input.bool(false, title="", inline="inline2", group="Trading Time Limiter", tooltip="Hours between which the trades can happen. The time is always in the exchange's timezone.")hours_to_trade_on2 = input.session("0930-1600", title="(2) Valid Trading Hours Between", inline="inline2", group="Trading Time Limiter")limit_day3 = input.bool(false, title="", group="Trading Time Limiter", inline="day3")days_to_trade_on3 = input.string("1234567", title="(3) Valid Trading Days", inline="day3", tooltip="Values represent days: \nSunday (1), Monday (2), ..., Friday (6), Saturday(7)\n\nScript will trade on days that are present in this field. Please make sure that this field and also (3) Valid Trading Hours Between is checked.", group="Trading Time Limiter")valid_hours3 = input.bool(false, title="", inline="inline3", group="Trading Time Limiter", tooltip="Hours between which the trades can happen. The time is always in the exchange's timezone.")hours_to_trade_on3 = input.session("0930-1600", title="(3) Valid Trading Hours Between", inline="inline3", group="Trading Time Limiter")// PineConnector Automationuse_pc_automation = input.bool(false, title="Use PineConnector Automation | PLEASE READ TOOLTIP -->", group="PineConnector Automation", tooltip="NOTE! In order for the connection to MetaTrader to work, you will need do perform prerequisite steps, you can follow our full guide at our website, or refer to the official PineConnector Documentation.\n\nTo set up PineConnector Automation on the TradingView side, you will need to do the following:\n\n1. Fill out the License ID field with your PineConnector License ID;\n\n2. Fill out the Risk (trading volume) with the desired volume to be traded in each trade (the meaning of this value depends on the EA settings in Metatrader. Follow the detailed guide for additional information);\n\n3. After filling out the fields, you need to enable the 'Use PineConnector Automation' option (check the box in the strategy settings);\n\n4. Check if the chart has updated and you can see the appropriate order comments on your chart;\n\n5. Create an alert with the strategy selected as Condition, and the Message as {{strategy.order.comment}} (should be there by default);\n\n6. Enable the Webhook URL in the Notifications section, set it as the official PineConnector webhook address and enjoy your connection with MetaTrader.")pc_licence_id = input.int(60123456789, title="License ID", maxval=9999999999999, group="PineConnector Automation")pc_risk = input.float(1, title="Risk (trading volume)", group="PineConnector Automation")pc_long_entry_alert = str.tostring(pc_licence_id) + ',buy,' + syminfo.ticker + ',risk='+ str.tostring(pc_risk) + ',comment="ATR GOD Strategy by TradeSmart"'pc_short_entry_alert = str.tostring(pc_licence_id) + ',sell,' + syminfo.ticker + ',risk='+ str.tostring(pc_risk) + ',comment="ATR GOD Strategy by TradeSmart"'pc_long_exit_alert = str.tostring(pc_licence_id) + ',closelong,' + syminfo.ticker + ',risk='+ str.tostring(pc_risk) + ',comment="ATR GOD Strategy by TradeSmart"'pc_short_exit_alert = str.tostring(pc_licence_id) + ',closeshort,' + syminfo.ticker + ',risk='+ str.tostring(pc_risk) + ',comment="ATR GOD Strategy by TradeSmart"'// LIMITERSin_date() =>     time > start_date and time < end_date    check_valid_session() =>    s1 = limit_session1 ? session1 : na    s2 = limit_session2 ? session2 : na    s3 = limit_session3 ? session3 : na    s4 = limit_session4 ? session4 : na    use_session_limit ? na(s1) and na(s2) and na(s3) and na(s4) ? false : true : true   check_valid_time() =>    t = (limit_day1 == false and limit_day2 == false and limit_day3 == false) ? time(timeframe.period, '0000-0000:' + days_to_trade_on) : na    t7 = valid_hours1 and limit_day1 == false ? time(timeframe.period, hours_to_trade_on1 + ':' + days_to_trade_on) : na    t8 = valid_hours2 and limit_day2 == false ? time(timeframe.period, hours_to_trade_on2 + ':' + days_to_trade_on) : na    t9 = valid_hours3 and limit_day3 == false ? time(timeframe.period, hours_to_trade_on3 + ':' + days_to_trade_on) : na    t1 = valid_hours1 and limit_day1 ? time(timeframe.period, hours_to_trade_on1 + ':' + days_to_trade_on1) : na    t2 = valid_hours2 and limit_day2 ? time(timeframe.period, hours_to_trade_on2 + ':' + days_to_trade_on2) : na    t3 = valid_hours3 and limit_day3 ? time(timeframe.period, hours_to_trade_on3 + ':' + days_to_trade_on3) : na    na(t) and na(t1) and na(t2) and na(t3) and na(t7) and na(t8) and na(t9) ? false : true check_filters_long() => check_volume_filter() and check_waddah_attar_long() and check_valid_session() and check_atr_lim_long() and check_trend_filter_long()check_filters_short() => check_volume_filter() and check_waddah_attar_short() and check_valid_session() and check_atr_lim_short() and check_trend_filter_short()checkLong() => check_entry_long() and check_filters_long() checkShort() => check_entry_short() and check_filters_short() should_long_limit_dates = limit_dates ? (in_date() and checkLong()) : checkLong()should_short_limit_dates = limit_dates ? (in_date() and checkShort()) : checkShort()should_long_limit_day_trades = limit_trading_time ? (check_valid_time() and checkLong()): checkLong()should_short_limit_day_trades = limit_trading_time ? (check_valid_time() and checkShort()): checkShort()long = should_long_limit_dates and should_long_limit_day_trades and allow_longshort = should_short_limit_dates and should_short_limit_day_trades and allow_short// CALCULATE EXIT PRICES AND STOP LOSSESlong_exit_price = float(na)long_stop_price = float(na)short_exit_price = float(na)short_stop_price = float(na)long_exit_price := (long and strategy.position_size <= 0) ? b_atr_buy : long_exit_price[1]long_stop_price := (long and strategy.position_size <= 0) ? b_atr_sell : long_stop_price[1]short_exit_price := (short and strategy.position_size >= 0) ? s_atr_buy : short_exit_price[1]short_stop_price := (short and strategy.position_size >= 0) ? s_atr_sell : short_stop_price[1]plot(strategy.position_size > 0 and plot_sl_tp ? long_exit_price : na, color=color.green, style=plot.style_linebr, linewidth=2, title="Long Exit Price")plot(strategy.position_size > 0 and plot_sl_tp ? long_stop_price : na, color=color.red, style=plot.style_linebr, linewidth=2, title="Long Stop Price")plot(strategy.position_size < 0 and plot_sl_tp ? short_exit_price : na, color=color.purple, style=plot.style_linebr, linewidth=2, title="Short Exit Price")plot(strategy.position_size < 0 and plot_sl_tp ? short_stop_price : na, color=color.aqua, style=plot.style_linebr, linewidth=2, title="Short Stop Price")// QUANTITY CALCULATIONourQty = switch order_size_type    "Capital Percentage" => (strategy.initial_capital + strategy.netprofit) * 0.01 * order_size_value / close     "Cash" => order_size_value / close     "Contract(s)" => order_size_value     => 0// TEST// ENTER/EXIT ORDERScheckForceExit(usage_trigger, exit_trigger, order_comment) =>    if strategy.position_size != 0 and usage_trigger        if exit_trigger            strategy.cancel_all()            if use_pc_automation                strategy.close_all(comment=strategy.position_size > 0 ? pc_long_exit_alert : pc_short_exit_alert)            else                strategy.close_all(comment=order_comment, immediately=true)plotshape(plot_signals and strategy.position_size == 0 ? long : na, style=shape.labelup, location=location.belowbar, color=color.new(#046ff9, 0), size=size.large, text='Entry Signal \n Long/Buy', textcolor=color.new(color.white, 10))plotshape(plot_signals and strategy.position_size == 0 ? short : na, style=shape.labeldown, location=location.abovebar, color=color.new(#046ff9, 0), size=size.large, text='Entry Signal \n Short/Sell', textcolor=color.new(color.white, 10))valid_values = trueif (na(nnatr) and use_atr_based_sl) or (na(lowest_point_sl) and use_low_high_based_sl) or (na(highest_point_sl) and use_low_high_based_sl)    valid_values := falseif valid_values    if allow_long        if long and strategy.position_size == 0            strategy.order("Long Entry", direction=strategy.long, qty=ourQty, oca_type=strategy.oca.none, comment=use_pc_automation ? pc_long_entry_alert : na)        if strategy.position_size > 0            strategy.cancel("Long Entry")            strategy.order("Long Exit", direction=strategy.short, qty=strategy.position_size, limit=long_exit_price, oca_type=strategy.oca.reduce, oca_name="asd", comment=use_pc_automation ? pc_long_exit_alert : na)            strategy.order("Long Stop", direction=strategy.short, qty=strategy.position_size, stop=long_stop_price, oca_type=strategy.oca.reduce, oca_name="asd", comment=use_pc_automation ? pc_long_exit_alert : na)    if allow_short        if short and strategy.position_size == 0            strategy.order("Short Entry", direction=strategy.short, qty=ourQty, oca_type=strategy.oca.none, comment=use_pc_automation ? pc_short_entry_alert : na)        if strategy.position_size < 0            strategy.cancel("Short Entry")            strategy.order("Short Exit", direction=strategy.long, qty=-1*strategy.position_size, limit=short_exit_price, oca_type=strategy.oca.reduce, oca_name="asd", comment=use_pc_automation ? pc_short_exit_alert : na)            strategy.order("Short Stop", direction=strategy.long, qty=-1*strategy.position_size, stop=short_stop_price, oca_type=strategy.oca.reduce, oca_name="asd", comment=use_pc_automation ? pc_short_exit_alert : na)    checkForceExit(use_force_exit_exact_time_1, custom_session_1[1] and not custom_session_1, "Custom Session Force Exit 1")    checkForceExit(use_force_exit_exact_time_2, custom_session_2[1] and not custom_session_2, "Custom Session Force Exit 2")    checkForceExit(use_force_exit_exact_time_3, custom_session_3[1] and not custom_session_3, "Custom Session Force Exit 3")    checkForceExit(use_force_exit_exact_time_4, custom_session_4[1] and not custom_session_4, "Custom Session Force Exit 4")