Zeal Terminal Open in Zeal Terminal

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
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (21)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100$203Equity from $100
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 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.
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 verified

Neither 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 verified

Neither 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.

SettingDefaultType and rangeFeeds
MA №1trueboolma1p entry BUY close BUY entry BUYzone plot line 84 line 86 line 88
Ma1type (no label in the script)EMAstring · options ["SMA","EMA","RMA","WMA","VWMA"]ma1
Ma1src (no label in the script)closesourcema1
Ma1Len (no label in the script)9int (written input.integer)ma1
MA №1 Line colorupcolorma1p plot
Zone color.new(color.lime, 70)colorcross_zone_color
Width 2int (written input.integer)ma1p plot
MA №2trueboolma2p entry BUY close BUY entry BUYzone plot line 84 line 86 line 88
Ma2type (no label in the script)SMAstring · options ["SMA","EMA","RMA","WMA","VWMA"]ma2
Ma2src (no label in the script)closesourcema2
Ma2Len (no label in the script)21int (written input.integer)ma2
MA №2 Line colordncolorma2p plot
Zone color.new(#e91e63, 70)colorcross_zone_color
Width 2int (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 3trueboolunused
MA №3falseboolma3p ma3p2 entry BUYzone close BUYzone plot line 88 line 90
Ma3type (no label in the script)SMAstring · options ["SMA","EMA","RMA","WMA","VWMA"]ma3H ma3L
Ma3Len (no label in the script)50int (written input.integer)ma3H ma3L
Ma3col (no label in the script)colordncolorma3p ma3p2 plot
Zone col on (no label in the script)falseboolBigcross_zone_color
Ma3col up (no label in the script)color.new(color.lime, 70)colorBigcross_zone_color
Ma3col dn (no label in the script)color.new(#e91e63, 70)colorBigcross_zone_color
Cross Sign ON/OFF | trueboolCrossUP Sign CrossDN Sign
UPcolor.whitecolorCrossUP Sign
DN#e91e63colorCrossDN Sign
Backtesting Section 🕖🕔🕟🕤
BackTesting ON/OFFfalseboolentry BUY close BUY entry BUYzone close BUYzone line 84 line 86 line 88 line 90
Start Timetimestamp("01 Jan 2021")timeinDateRange
End Timetimestamp("01 Jan 2100")timeinDateRange
BOT SECTION
BOT ID stringenter_msg exit_msg
Tokenstringenter_msg exit_msg

What it calculates

  • Crossover (crossover, ta.crossover in v5)close, ma3HZoneCrossover · line 58
  • Crossunder (crossunder, ta.crossunder in v5)close, ma3LZoneCrossunder · line 59
  • Crossover (crossover, ta.crossover in v5)ma1, ma2maCrossOver · line 62
  • Crossunder (crossunder, ta.crossunder in 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.

closecloseprice datama1LenMa1Lensetting · 9ma1typeMa1typesetting · EMAma2LenMa2Lensetting · 21ma2typeMa2typesetting · SMAhighhighprice datama3LenMa3Lensetting · 50ma3typeMa3typesetting · SMAlowlowprice datatimetimeprice datastartTimeStart Timesetting · timestamp("01 Jan 2…endTimeEnd Timesetting · timestamp("01 Jan 2…ZoneCrossoverCrossover→ ZoneCrossoverZoneCrossunderCrossunder→ ZoneCrossundermaCrossOverCrossover→ maCrossOvermaCrossUnderCrossunder→ maCrossUnderma1ma1valuema2ma2valuema3Hma3Hvaluema3Lma3LvalueinDateRangeinDateRangeconditionBigCrossSignalBigCrossSignalconditioncolorup, colordn, Bigcross_zone_color, cross_zone_colorColourcolorup · colordn +2entry:BUYOpen BUYstrategy.entryclose:BUYClose BUYstrategy.closeentry:BUYzoneOpen BUYzonestrategy.entryclose:BUYzoneClose BUYzonestrategy.closeclose_all:close_all strategy.close_allplot:25plotplotplot:35plotplotplot:49plotplotplot:50plotplotfill:Cross Background ColorCross Background Colorfill × 2plotshape:67CrossUP Signplotshapeplotshape:68CrossDN Signplotshape

Order rules

OrderFires whenBy defaultLine
Open BUY longmaCrossOver and inDateRange and backtest_on and ma1_show and ma2_showOn85
Close BUYmaCrossUnder and inDateRange and backtest_on and ma1_show and ma2_showOn87
Open BUYzone longZoneCrossover and backtest_on and inDateRange and ma3_show and not ma1_show and not ma2_showOn89
Close BUYzoneZoneCrossunder and backtest_on and inDateRange and ma3_showOn91
Close (not inDateRange)On93

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 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 31 msWith a workaround 1,000 bars in 85 msNot measured
PineTSNo 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()