Pine Script v5 · Strategy
Zazzamira 50-25-25 Trend System
A Pine Script v5 strategy built on Valuewhen (start_t, bar_index) and ATR (14). It has 12 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is 4 contracts and pays no commission. 21 settings; defaults include Timezone UTC-5, Opening Range 0830-0915 and Trading Time 0915-1300.
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 Zazzamira 50-25-25 Trend System repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Zazzamira 50-25-25 Trend System 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.
- Does Zazzamira 50-25-25 Trend System run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L142:C11: cannot use 'int' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download.
- Does Zazzamira 50-25-25 Trend System use a stop loss?
- Yes
- strategy.exit sets a stop on line 163, 164, 165, 166, 167, 168.
- Does Zazzamira 50-25-25 Trend System run in Zeal Terminal?
- Yes
- It compiles in 266 ms and runs 1,000 bars in 443 ms, in the browser.
BTCUSDT · 1D · default settings
- MA №1
- MA №2
- MA №3
- MA #4
- 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,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
1 setting does nothing
“Use 3rd MA as Entry Condition” is declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
12 settings have no label
In the settings dialog ma1_type (line 73), ma1_source (line 74), ma1_length (line 75), ma2_type (line 78), ma2_source (line 79), ma2_length (line 80), ma3_type (line 84), ma3_source (line 85), ma3_length (line 86), ma4_type (line 89), ma4_source (line 90), ma4_length (line 91) 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.
-
Note
Uses an argument v6 removed
when = on line 177, 178. The upgraded version below moves each call inside an if block.
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 |
|---|---|---|---|
| Time-Range Settings | |||
| Timezone | UTC-5 | string | tz |
| Exchange Timezone | true | bool | tz |
| Opening Range | 0830-0915 | session | tses_time |
| Trading Time | 0915-1300 | session | t |
| Use 3rd MA as Entry Condition | true | bool | unused |
| Use RETEST | true | bool | longf shortf |
| Initial Stop Loss ATR | 1.0 | float · min 0 · step 0.1 | trail_long_final1 trail_short_final1 |
| Backtesting Start Time | timestamp("01 Sep 2002 13:30 +0000") | time | timeCond |
| Backtesting End Time | timestamp("30 Sep 2099 19:30 +0000") | time | timeCond |
| MA SETTINGS | |||
| Ma1 type (no label in the script) | EMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | ma1 |
| Ma1 source (no label in the script) | close | source | ma1 |
| Ma1 length (no label in the script) | 5 | int · min 1 | ma1 |
| Ma2 type (no label in the script) | EMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | ma2 |
| Ma2 source (no label in the script) | close | source | ma2 |
| Ma2 length (no label in the script) | 13 | int · min 1 | ma2 |
| Ma3 type (no label in the script) | EMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | ma3 |
| Ma3 source (no label in the script) | close | source | ma3 |
| Ma3 length (no label in the script) | 34 | int · min 1 | ma3 |
| Ma4 type (no label in the script) | EMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | ma4 |
| Ma4 source (no label in the script) | close | source | ma4 |
| Ma4 length (no label in the script) | 50 | int · min 1 | ma4 |
What it calculates
- Valuewhenstart_t, bar_index, 0
last_start_n · line 26 - ATR14
atr · line 117 - ValuewhenlongCond, atr, 0
atr_long · line 119 - ValuewhenshortCond, atr, 0
atr_short · line 120
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 103 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open long long | long0 | On | 159 |
| Open short short | short0 | On | 161 |
| Exit SL/TP1 stop and limit | equity>0 and timeCond | On | 163 |
| Exit SL/TP2 stop and limit | equity>0 and timeCond | On | 164 |
| Exit SL/TP3 stop and limit | equity>0 and timeCond | On | 165 |
| Exit SL/TP1 stop and limit | equity>0 and timeCond | On | 166 |
| Exit SL/TP2 stop and limit | equity>0 and timeCond | On | 167 |
| Exit SL/TP3 stop and limit | equity>0 and timeCond | On | 168 |
| cancel long | high>l1 or not trading_session_filter | On | 170 |
| cancel short | low<s1 or not trading_session_filter | On | 172 |
| Close long | long_exit and timeCond | On | 177 |
| Close short | short_exit and timeCond | On | 178 |
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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.
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
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Zazzamira 50-25-25 Trend System this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| [fpemehd] Strategy Template by DuDu95 | atr valuewhen | v5 strategy | +10.5% | 41 | 14.8% |
| Crypto EMA Trend Reversal Strategy by ADHDCRYPT0 | atr valuewhen | v4 strategy | +37.5% | 37 | 18.3% |
| Positive Bars - Strategy by tweakerID | valuewhen atr | v4 strategy | −40.3% | 7 | 54.7% |
| Big Bar Strategy by tweakerID | valuewhen atr | v4 strategy | −56.6% | 13 | 57.1% |
| VWMA-SMA 3Commas Bot by CrackingCryptocurrency | atr valuewhen | v5 strategy | −1,774,150,000.0% | 157 | 50,545.9% |
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.
- 2 strategy calls use the when = argument (line 177, 178). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 3 settings use the untyped input() (line 7, 83, 108). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 7: input() → input.bool()
- Line 83: input() → input.bool()
- Line 108: input() → input.bool()
- Line 177: when = long_exit and timeCond → if block
- Line 178: when = short_exit and timeCond → if block
⋯tz0 = input.string('UTC-5', title="Timezone", inline='tz', group='Time-Range Settings')-auto_tz = input(true, title="Exchange Timezone", inline='tz', group='Time-Range Settings')+auto_tz = input.bool(true, title="Exchange Timezone", inline='tz', group='Time-Range Settings')tz = auto_tz? syminfo.timezone : tz0⋯plot(ma2, color = color.orange, title="MA №2")-use_3 = input(true, title='Use 3rd MA as Entry Condition')+use_3 = input.bool(true, title='Use 3rd MA as Entry Condition')ma3_type = input.string("EMA" , "" , inline="MA #3", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)⋯ short_setup := 0-retest = input(true, title='Use RETEST')+retest = input.bool(true, title='Use RETEST')longf = retest? long : long0 ⋯ pos:=0-strategy.close("long" , when=long_exit and timeCond, comment="Exit")+if long_exit and timeCond+ strategy.close("long" , comment="Exit")-strategy.close("short", when=short_exit and timeCond, comment="Exit")+if short_exit and timeCond+ strategy.close("short", comment="Exit")// DEBUGGING⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L142:C11: cannot use 'int' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © Hiubris_Indicators-//@version=5+//@version=6strategy(title = "Zazzamira 50-25-25 Trend System", overlay = true, default_qty_value = 4, initial_capital=100000,default_qty_type=strategy.fixed, pyramiding=0, process_orders_on_close=true, max_lines_count=500)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 266 ms | With a workaround 1,000 bars in 443 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
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.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Hiubris_Indicators//@version=5strategy(title = "Zazzamira 50-25-25 Trend System", overlay = true, default_qty_value = 4, initial_capital=100000,default_qty_type=strategy.fixed, pyramiding=0, process_orders_on_close=true, max_lines_count=500)// Open Sessiontz0 = input.string('UTC-5', title="Timezone", inline='tz', group='Time-Range Settings')auto_tz = input(true, title="Exchange Timezone", inline='tz', group='Time-Range Settings')tz = auto_tz? syminfo.timezone : tz0timeinput = input.session('0830-0915', title="Opening Range", group='Time-Range Settings') + ':1234567'tses_time = time(timeframe.period, timeinput, tz)tses = na(tses_time) ? 0 : 1end_t = tses[1] and not tsesstart_t = tses and not tses[1]// Trading Sessionsession = input.session("0915-1300", title="Trading Time")+":1234567"t = time(timeframe.period, session, tz)trading_session_filter = na(t) ? 0 : 1t_exit = time(timeframe.period, "1500-0000:1234567", tz)trading_session_exit = na(t_exit) ? 0 : 1// Highs Lows - Open sesssionh = 0.0l = 0.0h := start_t ? high : tses and high > h[1] ? high : h[1]l := start_t ? low : tses and low < l[1] ? low : l[1]r = h-llast_start_n = ta.valuewhen(start_t, bar_index, 0)//col = input.color(color.orange, title="Levels Color")draw_level(txt, x, col)=> if start_t line.new (bar_index-4, x, last_start_n[1], x, color=col) label.new(bar_index-10, x, style=label.style_none, text=txt, color=col, textcolor=col)l1 = h+r*0.216l2 = h+r*0.618l3 = h+r*1l4 = h+r*1.618s1 = l-r*0.216s2 = l-r*0.618s3 = l-r*1s4 = l-r*1.618plot(tses? na : h, style=plot.style_linebr, title="H", color=color.green)plot(tses? na : l, style=plot.style_linebr, title="L", color=color.green)plot(tses? na : l1, style=plot.style_linebr, title="Fib 1", color=color.orange)plot(tses? na : l2, style=plot.style_linebr, title="Fib 2", color=color.orange)plot(tses? na : l3, style=plot.style_linebr, title="Fib 3", color=color.orange)plot(tses? na : l4, style=plot.style_linebr, title="Fib 4", color=color.orange)plot(tses? na : s1, style=plot.style_linebr, title="Fib 1", color=color.orange)plot(tses? na : s2, style=plot.style_linebr, title="Fib 2", color=color.orange)plot(tses? na : s3, style=plot.style_linebr, title="Fib 3", color=color.orange)plot(tses? na : s4, style=plot.style_linebr, title="Fib 4", color=color.orange)//draw_level('H' , h[1], color.gray )//draw_level('Fib 23.6% ' , l1, color.yellow)//draw_level('Fib 61.8% ' , l2, color.orange)//draw_level('Fib 100% ' , l3, color.orange)//draw_level('Fib 161.8% ', l4, color.orange)//draw_level('H' , l[1], color.gray )//draw_level('Fib 23.6% ' , s1, color.yellow)//draw_level('Fib 61.8% ' , s2, color.orange)//draw_level('Fib 100% ' , s3, color.orange)//draw_level('Fib 161.8% ', s4, color.orange)bgcolor(tses?color.new(color.orange , 80):na)plotshape(ta.crossover (close, h) and not tses and trading_session_filter, textcolor=color.lime, color=color.lime, style=shape.triangleup , title="Cross", text="" , location=location.belowbar, offset=0, size=size.tiny)plotshape(ta.crossunder(close, l) and not tses and trading_session_filter, textcolor=color.red, color=color.red, style=shape.triangledown, title="Cross", text="", location=location.abovebar, offset=0, size=size.tiny)// ————— MA ribbon_grp = "MA SETTINGS"ma(source, length, type) => type == "SMA" ? ta.sma(source, length) : type == "EMA" ? ta.ema(source, length) : type == "SMMA (RMA)" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na ma1_type = input.string("EMA" , "" , inline="MA #1", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)ma1_source = input.source(close , "" , inline="MA #1", group=ribbon_grp)ma1_length = input.int (5 , "" , inline="MA #1", minval=1, group=ribbon_grp)ma1 = ma(ma1_source, ma1_length, ma1_type)plot(ma1, color = color.green, title="MA №1")ma2_type = input.string("EMA" , "" , inline="MA #2", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)ma2_source = input.source(close , "" , inline="MA #2", group=ribbon_grp)ma2_length = input.int (13 , "" , inline="MA #2", minval=1, group=ribbon_grp)ma2 = ma(ma2_source, ma2_length, ma2_type)plot(ma2, color = color.orange, title="MA №2")use_3 = input(true, title='Use 3rd MA as Entry Condition')ma3_type = input.string("EMA" , "" , inline="MA #3", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)ma3_source = input.source(close , "" , inline="MA #3", group=ribbon_grp)ma3_length = input.int (34 , "" , inline="MA #3", minval=1, group=ribbon_grp)ma3 = ma(ma3_source, ma3_length, ma3_type)plot(ma3, color = color.blue, title="MA №3")ma4_type = input.string("EMA" , "" , inline="MA #4", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=ribbon_grp)ma4_source = input.source(close , "" , inline="MA #4", group=ribbon_grp)ma4_length = input.int (50 , "" , inline="MA #4", minval=1, group=ribbon_grp)ma4 = ma(ma4_source, ma4_length, ma4_type)plot(ma4, color = color.red, title="MA #4")ma_long = ma1>ma2 and ma2>ma3 and ma3>ma4ma_short= ma1<ma2 and ma2<ma3 and ma3<ma4long0 = ma_long and trading_session_filter and high<l1 and ta.crossover (close, h)short0= ma_short and trading_session_filter and low >s1 and ta.crossunder(close, l)long_setup = 0 long_setup:= high>l1? 0 : long0? 1 : long_setup[1]long = low<h and long_setup[1]==1if long long_setup := 0short_setup = 0 short_setup:= low<s1? 0 : short0? 1 : short_setup[1]short = high>l and short_setup[1]==1if short short_setup := 0retest = input(true, title='Use RETEST')longf = retest? long : long0 shortf= retest? short : short0// Position Management Toolspos = 0.0pos:= longf? 1 : shortf? -1 : pos[1]longCond = longf and (pos[1]!= 1 or na(pos[1]))shortCond = shortf and (pos[1]!=-1 or na(pos[1]))// EXIT FUNCTIONS //atr = ta.atr(14)sl = input.float(1.0, title="Initial Stop Loss ATR", minval=0, step=0.1)atr_long = ta.valuewhen(longCond , atr, 0)atr_short = ta.valuewhen(shortCond, atr, 0)tp_long = l3tp_short = s3// Inprofitinprofit_long = 0inprofit_short = 0inprofit_long := pos==0 or longCond ? 0 : high>l1[1]? 1 : inprofit_long [1]inprofit_short := pos==0 or shortCond? 0 : low <s1[1]? 1 : inprofit_short[1]inprofit_long2 = 0inprofit_short2 = 0inprofit_long2 := pos==0 or longCond ? 0 : high>l2[1]? 1 : inprofit_long2 [1]inprofit_short2 := pos==0 or shortCond? 0 : low <s2[1]? 1 : inprofit_short2[1]// Trailing Stop Losstrail_long = 0.0, trail_short = 0.0trail_long := long0 ? h : longCond ? high : high>trail_long[1]? high : pos<1 ? 0 : trail_long[1]trail_short := short0? l : shortCond? low : low<trail_short[1]? low : pos>-1 ? 99999 : trail_short[1]trail_long_final1 = trail_long - sl * atr_long trail_short_final1 = trail_short + sl * atr_shorttrail_long_final2 = trail_long - r * 0.236trail_short_final2 = trail_short + r * 0.236trail_long_final3 = trail_long - r * 0.382trail_short_final3 = trail_short + r * 0.382sl_long = inprofit_long2 ? trail_long_final3 : inprofit_long ? trail_long_final2 : trail_long_final1sl_short = inprofit_short2? trail_short_final3 : inprofit_short? trail_short_final2 : trail_short_final1// Position Adjustmentlong_sl = low <sl_long[1] and pos[1]== 1short_sl = high>sl_short[1] and pos[1]==-1final_long_tp = high>tp_long[1] and pos[1]== 1final_short_tp = low <tp_short[1] and pos[1]==-1if ((long_sl or final_long_tp) and not shortCond) or ((short_sl or final_short_tp) and not longCond) pos:=0 // Strategy Backtest Limiting Algorithmi_startTime = input.time(defval = timestamp("01 Sep 2002 13:30 +0000"), title = "Backtesting Start Time")i_endTime = input.time(defval = timestamp("30 Sep 2099 19:30 +0000"), title = "Backtesting End Time" )timeCond = (time > i_startTime) and (time < i_endTime)equity = strategy.initial_capital + strategy.netprofitif equity>0 and timeCond if long0 strategy.entry("long" , strategy.long , limit=h) if short0 strategy.entry("short", strategy.short, limit=l) strategy.exit("SL/TP1", from_entry = "long" , stop=sl_long , limit=l1 , comment_profit ='TP1', comment_loss='SL', qty_percent=50) strategy.exit("SL/TP2", from_entry = "long" , stop=sl_long , limit=l2 , comment_profit ='TP2', comment_loss='SL', qty_percent=25) strategy.exit("SL/TP3", from_entry = "long" , stop=sl_long , limit=l3 , comment_profit ='TP3', comment_loss='SL') strategy.exit("SL/TP1", from_entry = "short", stop=sl_short, limit=s1, comment_profit ='TP1', comment_loss='SL', qty_percent=50) strategy.exit("SL/TP2", from_entry = "short", stop=sl_short, limit=s2, comment_profit ='TP2', comment_loss='SL', qty_percent=25) strategy.exit("SL/TP3", from_entry = "short", stop=sl_short, limit=s3, comment_profit ='TP3', comment_loss='SL')if high>l1 or not trading_session_filter strategy.cancel('long')if low<s1 or not trading_session_filter strategy.cancel('short')long_exit = trading_session_exit and pos[1]== 1short_exit= trading_session_exit and pos[1]==-1if (long_exit and not shortCond) or (short_exit and not longCond) pos:=0strategy.close("long" , when=long_exit and timeCond, comment="Exit")strategy.close("short", when=short_exit and timeCond, comment="Exit")// DEBUGGINGbgcolor(long ?color.new(color.green , 80):na)bgcolor(short?color.new(color.red , 80):na)bgcolor(false?color.new(color.white , 80):na)bgcolor(false?color.new(color.orange , 80):na)