Pine Script v4 · Strategy
Multi-X by HamidBox
A Pine Script v4 strategy built on Crossover (close, ma3H) and Crossunder (close, ma3L). It has 5 order rules, 2 entries among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100 in cash and pays 0.1 commission. 30 settings; defaults include Ma1type EMA, Ma1src close and Ma1Len 9.
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 Multi-X by HamidBox repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Multi-X by HamidBox 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. It closed no trades on the other markets either. A backtest, not investment advice.
- Can Multi-X by HamidBox be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does Multi-X by HamidBox use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Multi-X by HamidBox run in Zeal Terminal?
- Yes
- It compiles in 31 ms and runs 1,000 bars in 85 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- CrossUP Sign
- CrossDN Sign
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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, $100 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
1 setting does nothing
“For Safe Side = Read This >>>” is declared but never read.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Note
9 settings have no label
In the settings dialog ma1type (line 18), ma1src (line 19), ma1Len (line 20), ma2type (line 28), ma2src (line 29), ma2Len (line 30), ma3type (line 39), ma3Len (line 42), zone_col_on (line 44) show an empty name. The labels on this page come from the variable names.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
- Upgrading to v5 renames sma → ta.sma, ema → ta.ema, rma → ta.rma, wma → ta.wma, vwma → ta.vwma, crossover → ta.crossover, crossunder → ta.crossunder.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 5: type is reserved in v5: renamed type_
- Line 6: sma → ta.sma
- Line 7: ema → ta.ema
- Line 8: rma → ta.rma
- Line 9: wma → ta.wma
26 more edits
- Line 10: vwma → ta.vwma
- Line 17: input(type = input.bool) → input.bool()
- Line 19: input(type = input.source) → input.source()
- Line 20: input(type = input.integer) → input.int()
- Line 21: input(type = input.color) → input.color()
- Line 22: input(type = input.color) → input.color()
- Line 23: input(type = input.integer) → input.int()
- Line 27: input(type = input.bool) → input.bool()
- Line 29: input(type = input.source) → input.source()
- Line 30: input(type = input.integer) → input.int()
- Line 31: input(type = input.color) → input.color()
- Line 32: input(type = input.color) → input.color()
- Line 33: input(type = input.integer) → input.int()
- Line 38: input(type = input.bool) → input.bool()
- Line 42: input(type = input.integer) → input.int()
- Line 43: input(type = input.color) → input.color()
- Line 45: input(type = input.color) → input.color()
- Line 46: input(type = input.color) → input.color()
- Line 58: crossover → ta.crossover
- Line 59: crossunder → ta.crossunder
- Line 62: crossover → ta.crossover
- Line 63: crossunder → ta.crossunder
- Line 64: input(type = input.color) → input.color()
- Line 65: input(type = input.color) → input.color()
- Line 73: input(type = input.time) → input.time()
- Line 74: input(type = input.time) → input.time()
⋯// © HAMIDBOX-//@version=4+//@version=5strategy("Multi-X for BOT", overlay=true, default_qty_type=strategy.cash, default_qty_value=100, initial_capital=100, currency='USD', commission_value=0.1)-maType(source , length, type) =>+maType(source , length, type_) =>- type == "SMA" ? sma(source , length) :+ type_ == "SMA" ? ta.sma(source , length) :- type == "EMA" ? ema(source , length) :+ type_ == "EMA" ? ta.ema(source , length) :- type == "RMA" ? rma(source, length) : + type_ == "RMA" ? ta.rma(source, length) : - type == "WMA" ? wma(source, length) :+ type_ == "WMA" ? ta.wma(source, length) :- type == "VWMA" ? vwma(source, length) :+ type_ == "VWMA" ? ta.vwma(source, length) : na⋯/////////////////////////// MOVING AVERAGE №1 INPUTS ///////////////////////////-ma1_show = input(title="MA №1", defval=true, type=input.bool, inline="ma1")+ma1_show = input.bool(title="MA №1", defval=true, inline="ma1")ma1type = input(title="", defval="EMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma1")-ma1src = input(title="", defval=close, type=input.source, inline="ma1")+ma1src = input.source(title="", defval=close, inline="ma1")-ma1Len = input(title="", defval=9, type=input.integer, inline="ma1")+ma1Len = input.int(title="", defval=9, inline="ma1")-ma1col = input(colorup, "MA №1 Line ", type=input.color, inline="maz1")+ma1col = input.color(colorup, "MA №1 Line ", inline="maz1")-ma1_zon = input(color.new(color.lime, 70), " Zone ", type=input.color, inline="maz1")+ma1_zon = input.color(color.new(color.lime, 70), " Zone ", inline="maz1")-ma1_width = input(title=" Width ", defval=2, type=input.integer, inline="maz1")+ma1_width = input.int(title=" Width ", defval=2, inline="maz1")ma1 = maType(ma1src, ma1Len, ma1type)⋯/////////////////////////// MOVING AVERAGE №2 INPUTS ///////////////////////////-ma2_show = input(title="MA №2", defval=true, type=input.bool, inline="ma2")+ma2_show = input.bool(title="MA №2", defval=true, inline="ma2")ma2type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma2")-ma2src = input(title="", defval=close, type=input.source, inline="ma2")+ma2src = input.source(title="", defval=close, inline="ma2")-ma2Len = input(title="", defval=21, type=input.integer, inline="ma2")+ma2Len = input.int(title="", defval=21, inline="ma2")-ma2col = input(colordn, "MA №2 Line ", type=input.color, inline="maz2")+ma2col = input.color(colordn, "MA №2 Line ", inline="maz2")-ma2_zon = input(color.new(#e91e63, 70), " Zone ", type=input.color, inline="maz2")+ma2_zon = input.color(color.new(#e91e63, 70), " Zone ", inline="maz2")-ma2_width = input(title=" Width ", defval=2, type=input.integer, inline="maz2")+ma2_width = input.int(title=" Width ", defval=2, inline="maz2")ma2 = maType(ma2src, ma2Len, ma2type)⋯read = input(title="For Safe Side = Read This >>>", defval=true, group="Moving average zone section", tooltip="If you want to play on the safe side, Check ON Moving Average № 3, MA №3 shows the major trend, its work as a Trend-Zone,\nRule: Do not open trades if the market is below MA № 3, WHY? because Trend is Bearish and it will make more Down, NOTE:: It is possible after adding MA № 3, it will give you a small profit. But the great advantage of that, it will reduce your loss and it will also increase your Profit Factor.\nAnd if you not have any issue with Risk then you can Leave Moving Average No 3")-ma3_show = input(title="MA №3", defval=false, type=input.bool, inline="ma3" , group="Moving average zone section")+ma3_show = input.bool(title="MA №3", defval=false, inline="ma3" , group="Moving average zone section")ma3type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma3" , group="Moving average zone section")⋯// ma3srcL = input(title="", defval=low, type=input.source, inline="ma3")-ma3Len = input(title="", defval=50, type=input.integer, inline="ma3" , group="Moving average zone section")+ma3Len = input.int(title="", defval=50, inline="ma3" , group="Moving average zone section")-ma3col = input(colordn, "", type=input.color, inline="ma3" , group="Moving average zone section")+ma3col = input.color(colordn, "", inline="ma3" , group="Moving average zone section")zone_col_on = input(title="", defval=false, inline="ma3" , group="Moving average zone section")-ma3col_up = input(color.new(color.lime, 70), "", type=input.color, inline="ma3" , group="Moving average zone section")+ma3col_up = input.color(color.new(color.lime, 70), "", inline="ma3" , group="Moving average zone section")-ma3col_dn = input(color.new(#e91e63, 70), "", type=input.color, inline="ma3" , group="Moving average zone section")+ma3col_dn = input.color(color.new(#e91e63, 70), "", inline="ma3" , group="Moving average zone section")ma3H = maType(high, ma3Len, ma3type)⋯BigCrossSignal = close > ma3H-ZoneCrossover = crossover(close , ma3H)+ZoneCrossover = ta.crossover(close , ma3H)-ZoneCrossunder = crossunder(close , ma3L)+ZoneCrossunder = ta.crossunder(close , ma3L)//////////////////////////// PLOTING AND COOLORING /////////////////////////////Cross = input(true, "Cross Sign ON/OFF | ", inline="col", group="Moving average zone section") -maCrossOver = crossover(ma1 , ma2)+maCrossOver = ta.crossover(ma1 , ma2)-maCrossUnder = crossunder(ma1 , ma2)+maCrossUnder = ta.crossunder(ma1 , ma2)-col_buy = input(title="UP", type=input.color, defval=color.white, inline="col", group="Moving average zone section")+col_buy = input.color(title="UP", defval=color.white, inline="col", group="Moving average zone section")-col_sell = input(title="DN", type=input.color, defval=#e91e63, inline="col", group="Moving average zone section")+col_sell = input.color(title="DN", defval=#e91e63, inline="col", group="Moving average zone section")cross_zone_color = ma1 > ma2 ? ma1_zon : ma2_zon⋯///////////////////////////// BACK TESTING INPUTS //////////////////////////////-startTime = input(title="Start Time", type=input.time, defval= timestamp("01 Jan 2021"), group="Backtesting Section 🕖🕔🕟🕤")+startTime = input.time(title="Start Time", defval= timestamp("01 Jan 2021"), group="Backtesting Section 🕖🕔🕟🕤")-endTime = input(title="End Time", type=input.time, defval= timestamp("01 Jan 2100"), group="Backtesting Section 🕖🕔🕟🕤")+endTime = input.time(title="End Time", defval= timestamp("01 Jan 2100"), group="Backtesting Section 🕖🕔🕟🕤")inDateRange = (time >= startTime) and (time < endTime)⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 18: input() → input.string()
- Line 28: input() → input.string()
- Line 37: input() → input.bool()
- Line 39: input() → input.string()
- Line 44: input() → input.bool()
- Line 61: input() → input.bool()
3 more edits
- Line 71: input() → input.bool()
- Line 77: input() → input.string()
- Line 78: input() → input.string()
⋯ma1_show = input.bool(title="MA №1", defval=true, inline="ma1")-ma1type = input(title="", defval="EMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma1")+ma1type = input.string(title="", defval="EMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma1")ma1src = input.source(title="", defval=close, inline="ma1")⋯ma2_show = input.bool(title="MA №2", defval=true, inline="ma2")-ma2type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma2")+ma2type = input.string(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma2")ma2src = input.source(title="", defval=close, inline="ma2")⋯/////////////////////////// MOVING AVERAGE №3 INPUTS ///////////////////////////-read = input(title="For Safe Side = Read This >>>", defval=true, group="Moving average zone section", tooltip="If you want to play on the safe side, Check ON Moving Average № 3, MA №3 shows the major trend, its work as a Trend-Zone,\nRule: Do not open trades if the market is below MA № 3, WHY? because Trend is Bearish and it will make more Down, NOTE:: It is possible after adding MA № 3, it will give you a small profit. But the great advantage of that, it will reduce your loss and it will also increase your Profit Factor.\nAnd if you not have any issue with Risk then you can Leave Moving Average No 3")+read = input.bool(title="For Safe Side = Read This >>>", defval=true, group="Moving average zone section", tooltip="If you want to play on the safe side, Check ON Moving Average № 3, MA №3 shows the major trend, its work as a Trend-Zone,\nRule: Do not open trades if the market is below MA № 3, WHY? because Trend is Bearish and it will make more Down, NOTE:: It is possible after adding MA № 3, it will give you a small profit. But the great advantage of that, it will reduce your loss and it will also increase your Profit Factor.\nAnd if you not have any issue with Risk then you can Leave Moving Average No 3")ma3_show = input.bool(title="MA №3", defval=false, inline="ma3" , group="Moving average zone section")-ma3type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma3" , group="Moving average zone section")+ma3type = input.string(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma3" , group="Moving average zone section")// ma3srcH = input(title="", defval=high, type=input.source, inline="ma3")⋯ma3col = input.color(colordn, "", inline="ma3" , group="Moving average zone section")-zone_col_on = input(title="", defval=false, inline="ma3" , group="Moving average zone section")+zone_col_on = input.bool(title="", defval=false, inline="ma3" , group="Moving average zone section")ma3col_up = input.color(color.new(color.lime, 70), "", inline="ma3" , group="Moving average zone section")⋯//////////////////////////// PLOTING AND COOLORING /////////////////////////////-Cross = input(true, "Cross Sign ON/OFF | ", inline="col", group="Moving average zone section") +Cross = input.bool(true, "Cross Sign ON/OFF | ", inline="col", group="Moving average zone section") maCrossOver = ta.crossover(ma1 , ma2)⋯//////////////////////////////////////////////////////////////////-backtest_on = input(false, "BackTesting ON/OFF", group="Backtesting Section 🕖🕔🕟🕤")+backtest_on = input.bool(false, "BackTesting ON/OFF", group="Backtesting Section 🕖🕔🕟🕤")///////////////////////////// BACK TESTING INPUTS //////////////////////////////⋯///////////////////////////////// (CONDITIONS) /////////////////////////////////-bot_id = input(title="BOT ID ", defval='', inline="bot", group="BOT SECTION")+bot_id = input.string(title="BOT ID ", defval='', inline="bot", group="BOT SECTION")-email_token = input(title=" Token", defval='', inline="bot", group="BOT SECTION")+email_token = input.string(title=" Token", defval='', inline="bot", group="BOT SECTION")enter_msg = '{ "message_type": "bot", "bot_id":'+ bot_id + ', "email_token": "'+ email_token + '", "delay_seconds": 0 }'⋯Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © HAMIDBOX-//@version=5+//@version=6strategy("Multi-X for BOT", overlay=true, default_qty_type=strategy.cash, default_qty_value=100, initial_capital=100, currency='USD', commission_value=0.1)⋯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 |
|---|---|---|---|
| MA №1 | true | bool | ma1p entry BUY close BUY entry BUYzone plot line 84 line 86 line 88 |
| Ma1type (no label in the script) | EMA | string · options ["SMA","EMA","RMA","WMA","VWMA"] | ma1 |
| Ma1src (no label in the script) | close | source | ma1 |
| Ma1Len (no label in the script) | 9 | int (written input.integer) | ma1 |
| MA №1 Line | colorup | color | ma1p plot |
| Zone | color.new(color.lime, 70) | color | cross_zone_color |
| Width | 2 | int (written input.integer) | ma1p plot |
| MA №2 | true | bool | ma2p entry BUY close BUY entry BUYzone plot line 84 line 86 line 88 |
| Ma2type (no label in the script) | SMA | string · options ["SMA","EMA","RMA","WMA","VWMA"] | ma2 |
| Ma2src (no label in the script) | close | source | ma2 |
| Ma2Len (no label in the script) | 21 | int (written input.integer) | ma2 |
| MA №2 Line | colordn | color | ma2p plot |
| Zone | color.new(#e91e63, 70) | color | cross_zone_color |
| Width | 2 | int (written input.integer) | ma2p plot |
| Moving average zone section | |||
| For Safe Side = Read This >>>If you want to play on the safe side, Check ON Moving Average № 3, MA №3 shows the major trend, its work as a Trend-Zone,\nRule: Do not open trades if the market is below MA № 3, WHY? because Trend is Bearish and it will make more Down, NOTE:: It is possible after adding MA № 3, it will give you a small profit. But the great advantage of that, it will reduce your loss and it will also increase your Profit Factor.\nAnd if you not have any issue with Risk then you can Leave Moving Average No 3 | true | bool | unused |
| MA №3 | false | bool | ma3p ma3p2 entry BUYzone close BUYzone plot line 88 line 90 |
| Ma3type (no label in the script) | SMA | string · options ["SMA","EMA","RMA","WMA","VWMA"] | ma3H ma3L |
| Ma3Len (no label in the script) | 50 | int (written input.integer) | ma3H ma3L |
| Ma3col (no label in the script) | colordn | color | ma3p ma3p2 plot |
| Zone col on (no label in the script) | false | bool | Bigcross_zone_color |
| Ma3col up (no label in the script) | color.new(color.lime, 70) | color | Bigcross_zone_color |
| Ma3col dn (no label in the script) | color.new(#e91e63, 70) | color | Bigcross_zone_color |
| Cross Sign ON/OFF | | true | bool | CrossUP Sign CrossDN Sign |
| UP | color.white | color | CrossUP Sign |
| DN | #e91e63 | color | CrossDN Sign |
| Backtesting Section 🕖🕔🕟🕤 | |||
| BackTesting ON/OFF | false | bool | entry BUY close BUY entry BUYzone close BUYzone line 84 line 86 line 88 line 90 |
| Start Time | timestamp("01 Jan 2021") | time | inDateRange |
| End Time | timestamp("01 Jan 2100") | time | inDateRange |
| BOT SECTION | |||
| BOT ID | | string | enter_msg exit_msg |
| Token | | string | enter_msg exit_msg |
What it calculates
- Crossover (
crossover,ta.crossoverin v5)close, ma3HZoneCrossover · line 58 - Crossunder (
crossunder,ta.crossunderin v5)close, ma3LZoneCrossunder · line 59 - Crossover (
crossover,ta.crossoverin v5)ma1, ma2maCrossOver · line 62 - Crossunder (
crossunder,ta.crossunderin v5)ma1, ma2maCrossUnder · line 63
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open BUY long | maCrossOver and inDateRange and backtest_on and ma1_show and ma2_show | On | 85 |
| Close BUY | maCrossUnder and inDateRange and backtest_on and ma1_show and ma2_show | On | 87 |
| Open BUYzone long | ZoneCrossover and backtest_on and inDateRange and ma3_show and not ma1_show and not ma2_show | On | 89 |
| Close BUYzone | ZoneCrossunder and backtest_on and inDateRange and ma3_show | On | 91 |
| Close | (not inDateRange) | On | 93 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Similar scripts
No other indicator or strategy here shares enough of its calculations.
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 31 ms | With a workaround 1,000 bars in 85 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently merges fill() calls that share a title, so it would draw 1 of this script's 2 fills; this page gives each call its own title to draw all of them.
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report. PineTS runs Pine Script v5 and v6 only.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © HAMIDBOX//@version=4strategy("Multi-X for BOT", overlay=true, default_qty_type=strategy.cash, default_qty_value=100, initial_capital=100, currency='USD', commission_value=0.1)maType(source , length, type) => type == "SMA" ? sma(source , length) : type == "EMA" ? ema(source , length) : type == "RMA" ? rma(source, length) : type == "WMA" ? wma(source, length) : type == "VWMA" ? vwma(source, length) : na ////////////////////////////////////////////////////////////////////////////////colorup = #11ff00colordn = #e91e63/////////////////////////// MOVING AVERAGE №1 INPUTS ///////////////////////////ma1_show = input(title="MA №1", defval=true, type=input.bool, inline="ma1")ma1type = input(title="", defval="EMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma1")ma1src = input(title="", defval=close, type=input.source, inline="ma1")ma1Len = input(title="", defval=9, type=input.integer, inline="ma1")ma1col = input(colorup, "MA №1 Line ", type=input.color, inline="maz1")ma1_zon = input(color.new(color.lime, 70), " Zone ", type=input.color, inline="maz1")ma1_width = input(title=" Width ", defval=2, type=input.integer, inline="maz1")ma1 = maType(ma1src, ma1Len, ma1type)ma1p = plot(ma1_show ? ma1 : na, linewidth=ma1_width, color=color.new(ma1col , 0))/////////////////////////// MOVING AVERAGE №2 INPUTS ///////////////////////////ma2_show = input(title="MA №2", defval=true, type=input.bool, inline="ma2")ma2type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma2")ma2src = input(title="", defval=close, type=input.source, inline="ma2")ma2Len = input(title="", defval=21, type=input.integer, inline="ma2")ma2col = input(colordn, "MA №2 Line ", type=input.color, inline="maz2")ma2_zon = input(color.new(#e91e63, 70), " Zone ", type=input.color, inline="maz2")ma2_width = input(title=" Width ", defval=2, type=input.integer, inline="maz2")ma2 = maType(ma2src, ma2Len, ma2type)ma2p = plot(ma2_show ? ma2 : na, linewidth=ma2_width, color=color.new(ma2col , 0))/////////////////////////// MOVING AVERAGE №3 INPUTS ///////////////////////////read = input(title="For Safe Side = Read This >>>", defval=true, group="Moving average zone section", tooltip="If you want to play on the safe side, Check ON Moving Average № 3, MA №3 shows the major trend, its work as a Trend-Zone,\nRule: Do not open trades if the market is below MA № 3, WHY? because Trend is Bearish and it will make more Down, NOTE:: It is possible after adding MA № 3, it will give you a small profit. But the great advantage of that, it will reduce your loss and it will also increase your Profit Factor.\nAnd if you not have any issue with Risk then you can Leave Moving Average No 3")ma3_show = input(title="MA №3", defval=false, type=input.bool, inline="ma3" , group="Moving average zone section")ma3type = input(title="", defval="SMA", options=["SMA","EMA","RMA","WMA","VWMA"], inline="ma3" , group="Moving average zone section")// ma3srcH = input(title="", defval=high, type=input.source, inline="ma3")// ma3srcL = input(title="", defval=low, type=input.source, inline="ma3")ma3Len = input(title="", defval=50, type=input.integer, inline="ma3" , group="Moving average zone section")ma3col = input(colordn, "", type=input.color, inline="ma3" , group="Moving average zone section")zone_col_on = input(title="", defval=false, inline="ma3" , group="Moving average zone section")ma3col_up = input(color.new(color.lime, 70), "", type=input.color, inline="ma3" , group="Moving average zone section")ma3col_dn = input(color.new(#e91e63, 70), "", type=input.color, inline="ma3" , group="Moving average zone section")ma3H = maType(high, ma3Len, ma3type)ma3L = maType(low, ma3Len, ma3type)ma3p = plot(ma3_show ? ma3H : na, linewidth=1, color=color.new(ma3col , 50))ma3p2 = plot(ma3_show ? ma3L : na, linewidth=1, color=color.new(ma3col , 50))Bigcross_zone_color = if zone_col_on and close > ma3H ma3col_upelse if zone_col_on and close < ma3L ma3col_dnfill(ma3p , ma3p2, color=Bigcross_zone_color, title="Cross Background Color")BigCrossSignal = close > ma3HZoneCrossover = crossover(close , ma3H)ZoneCrossunder = crossunder(close , ma3L)//////////////////////////// PLOTING AND COOLORING /////////////////////////////Cross = input(true, "Cross Sign ON/OFF | ", inline="col", group="Moving average zone section") maCrossOver = crossover(ma1 , ma2)maCrossUnder = crossunder(ma1 , ma2)col_buy = input(title="UP", type=input.color, defval=color.white, inline="col", group="Moving average zone section")col_sell = input(title="DN", type=input.color, defval=#e91e63, inline="col", group="Moving average zone section")cross_zone_color = ma1 > ma2 ? ma1_zon : ma2_zonplotshape(Cross ? maCrossOver : na, title="CrossUP Sign", style=shape.triangleup, location=location.belowbar, color=col_buy, size=size.tiny)plotshape(Cross ? maCrossUnder : na, title="CrossDN Sign", style=shape.xcross, location=location.abovebar, color=col_sell, size=size.tiny)fill(ma1p , ma2p, color=cross_zone_color, title="Cross Background Color")//////////////////////////////////////////////////////////////////backtest_on = input(false, "BackTesting ON/OFF", group="Backtesting Section 🕖🕔🕟🕤")///////////////////////////// BACK TESTING INPUTS //////////////////////////////startTime = input(title="Start Time", type=input.time, defval= timestamp("01 Jan 2021"), group="Backtesting Section 🕖🕔🕟🕤")endTime = input(title="End Time", type=input.time, defval= timestamp("01 Jan 2100"), group="Backtesting Section 🕖🕔🕟🕤")inDateRange = (time >= startTime) and (time < endTime)///////////////////////////////// (CONDITIONS) /////////////////////////////////bot_id = input(title="BOT ID ", defval='', inline="bot", group="BOT SECTION")email_token = input(title=" Token", defval='', inline="bot", group="BOT SECTION")enter_msg = '{ "message_type": "bot", "bot_id":'+ bot_id + ', "email_token": "'+ email_token + '", "delay_seconds": 0 }'exit_msg = '{ "message_type": "bot", "bot_id":'+ bot_id + ', "email_token": "'+ email_token + '", "delay_seconds": 0 , "action": "close_at_market_price_all"}'// COPY PASTE THIS MSG TO TRADINGVIEW// {{strategy.order.alert_message}}///////////////////////////////// (CONDITIONS) /////////////////////////////////if maCrossOver and inDateRange and backtest_on and ma1_show and ma2_show strategy.entry("BUY", strategy.long, alert_message=enter_msg)if maCrossUnder and inDateRange and backtest_on and ma1_show and ma2_show strategy.close("BUY", comment="Exit", alert_message=exit_msg)if ZoneCrossover and backtest_on and inDateRange and ma3_show and not ma1_show and not ma2_show strategy.entry("BUYzone", strategy.long, alert_message=enter_msg)if ZoneCrossunder and backtest_on and inDateRange and ma3_show strategy.close("BUYzone", comment="Exit", alert_message=exit_msg)if (not inDateRange) strategy.close_all()