Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

DayTradingFutures Cross-Strategy

A Pine Script v4 strategy built on SMA (tr, 10), ATR (10) and WMA (close, 5). It has 0 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 11 settings; defaults include ATR Period 10, Source hl2 and ATR Multiplier 3.0.

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 DayTradingFutures Cross-Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did DayTradingFutures Cross-Strategy 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 entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
Can DayTradingFutures Cross-Strategy 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.
What alerts does DayTradingFutures Cross-Strategy have?
2
Buy; Sell.
Does DayTradingFutures Cross-Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • 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 (11)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100,000$202,527Equity from $100,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. 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, $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

    6 settings do nothing

    “Fast WMA Source”, “Fast WMA Period”, “Slow WMA Source”, “Slow WMA Period”, “Trend 50 Period Source”, “Trend 50 Period” are declared but never read.

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

  • 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, atr → ta.atr, max → math.max, min → math.min, wma → ta.wma, 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 6: input(type = input.integer) → input.int()
  • Line 8: input(type = input.float) → input.float()
  • Line 9: input(type = input.bool) → input.bool()
  • Line 10: input(type = input.bool) → input.bool()
  • Line 12: sma → ta.sma
9 more edits
  • Line 12: tr → ta.tr
  • Line 13: atr → ta.atr
  • Line 16: max → math.max
  • Line 19: min → math.min
  • Line 29: wma → ta.wma
  • Line 30: wma → ta.wma
  • Line 31: wma → ta.wma
  • Line 51: crossover → ta.crossover
  • Line 52: crossunder → ta.crossunder
⋯// © james4392010-//@version=4+//@version=5strategy(title="DayTradingFutures Cross-Strategy", overlay=true)// === GENERAL INPUTS ===-Periods = input(title="ATR Period", type=input.integer, defval=10)+Periods = input.int(title="ATR Period", defval=10)src = input(hl2, title="Source")-Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)+Multiplier = input.float(title="ATR Multiplier", step=0.1, defval=3.0)-changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)+changeATR= input.bool(title="Change ATR Calculation Method ?", defval=true)-showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)+showsignals = input.bool(title="Show Buy/Sell Signals ?", defval=true)//highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)-atr2 = sma(tr, Periods)+atr2 = ta.sma(ta.tr, Periods)-atr= changeATR ? atr(Periods) : atr2+atr= changeATR ? ta.atr(Periods) : atr2up=src-(Multiplier*atr)up1 = nz(up[1],up)-up := close[1] > up1 ? max(up,up1) : up+up := close[1] > up1 ? math.max(up,up1) : updn=src+(Multiplier*atr)dn1 = nz(dn[1], dn)-dn := close[1] < dn1 ? min(dn, dn1) : dn+dn := close[1] < dn1 ? math.min(dn, dn1) : dnwmaFastSource   = input(defval = close, title = "Fast WMA Source")⋯/// a couple of ma's..-wmaFast = wma(close, 5)+wmaFast = ta.wma(close, 5)-wmaSlow = wma(close, 20)+wmaSlow = ta.wma(close, 20)-wmaDirection = wma(close, 50)+wmaDirection = ta.wma(close, 50)// === PLOTTING ===⋯// === LOGIC ===-enterLong = crossover(wmaFast, wmaSlow) and close > wmaDirection and timeinrange(timeframe.period, "0900-1430")+enterLong = ta.crossover(wmaFast, wmaSlow) and close > wmaDirection and timeinrange(timeframe.period, "0900-1430")-enterShort = crossunder(wmaFast, wmaSlow) and close < wmaDirection and timeinrange(timeframe.period, "0900-1430")+enterShort = ta.crossunder(wmaFast, wmaSlow) and close < wmaDirection and timeinrange(timeframe.period, "0900-1430")//trend := nz(trend[1], trend)⋯

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 7: input() → input.source()
  • Line 20: input() → input.source()
  • Line 21: input() → input.int()
  • Line 22: input() → input.source()
  • Line 23: input() → input.int()
  • Line 24: input() → input.source()
  • Line 25: input() → input.int()
⋯Periods = input.int(title="ATR Period", defval=10)-src = input(hl2, title="Source")+src = input.source(hl2, title="Source")Multiplier = input.float(title="ATR Multiplier", step=0.1, defval=3.0)⋯dn := close[1] < dn1 ? math.min(dn, dn1) : dn-wmaFastSource   = input(defval = close, title = "Fast WMA Source")+wmaFastSource   = input.source(defval = close, title = "Fast WMA Source")-wmaFastLength   = input(defval = 5, title = "Fast WMA Period")+wmaFastLength   = input.int(defval = 5, title = "Fast WMA Period")-wmaSlowSource   = input(defval = close, title = "Slow WMA Source")+wmaSlowSource   = input.source(defval = close, title = "Slow WMA Source")-wmaSlowLength   = input(defval = 20, title = "Slow WMA Period")+wmaSlowLength   = input.int(defval = 20, title = "Slow WMA Period")-wmaDirectionSource  = input(defval = close, title = "Trend 50 Period Source")+wmaDirectionSource  = input.source(defval = close, title = "Trend 50 Period Source")-wmaDirectionLength  = input(defval = 50, title = "Trend 50 Period")+wmaDirectionLength  = input.int(defval = 50, title = "Trend 50 Period")timeinrange(res, sess) => time(res, sess) != 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.

⋯// © james4392010-//@version=5+//@version=6strategy(title="DayTradingFutures Cross-Strategy", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
ATR Period10int (written input.integer)atr2 atr
Sourcehl2sourceup dn
ATR Multiplier3.0float · step 0.1up dn
Change ATR Calculation Method ?trueboolatr
Show Buy/Sell Signals ?trueboolBuy Sell
Fast WMA Sourceclosesourceunused
Fast WMA Period5intunused
Slow WMA Sourceclosesourceunused
Slow WMA Period20intunused
Trend 50 Period Sourceclosesourceunused
Trend 50 Period50intunused

What it calculates

  • SMA (sma, ta.sma in v5)tr, ATR Period (10)atr2 · line 12
  • ATR (atr, ta.atr in v5)ATR Period (10)atr · line 13
  • WMA (wma, ta.wma in v5)close, 5wmaFast · line 29
  • WMA (wma, ta.wma in v5)close, 20wmaSlow · line 30
  • WMA (wma, ta.wma in v5)close, 50wmaDirection · line 31

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.

PeriodsATR Periodsetting · 10high · low · closehigh · low · closeprice dataclosecloseprice datahl2hl2price dataMultiplierATR Multipliersetting · 3.0atr2SMA→ atr2atrATR→ atrwmaFastWMA→ wmaFastwmaSlowWMA→ wmaSlowwmaDirectionWMA→ wmaDirectionupupvalueup1up1valuedndnvaluedn1dn1valuebuySignalbuySignalvaluesellSignalsellSignalvalueenterLong, enterShortenterLong · enterShort2 conditionsplot:33plotplotplot:34plotplotplot:35plotplotplotshape:58Buyplotshapeplotshape:62Sellplotshapealertcondition:68Buyalertconditionalertcondition:69Sellalertconditionfill:87Fillfill

Order rules

The script places no orders.

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

Alerts

AlertCallMessageLine
BuyalertconditionBuy!68
SellalertconditionSell!69

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

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

ScriptSharesTypeNetTradesMax drawdown
DayTradingFutures Cross-Strategy this page—v4 strategy0.0%00.0%
I11L - Better Buy Low Volatility or High Volatility- by I11Latr smav5 strategy+19.2%8337.4%
Vortex Cross w-MA Confirmation by DraftVentureatr smav5 strategy+2.4%524.7%
Configurable Multi MA Crossover Voting System by levieuxsma atrv5 strategy+28.5%539.4%
Swing Trend Strategy by Inkedlausma atrv5 strategy+11.2%516.2%
SSL Backtester With ATR SL TP and Money Management by JBTrippinsma atrv4 strategy+8.5%553.9%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 24 msWith a workaround 1,000 bars in 83 msNot measured
PineTSNo v5 and v6 only—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. 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/// © james4392010//@version=4strategy(title="DayTradingFutures Cross-Strategy", overlay=true)// === GENERAL INPUTS ===Periods = input(title="ATR Period", type=input.integer, defval=10)src = input(hl2, title="Source")Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)//highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)atr2 = sma(tr, Periods)atr= changeATR ? atr(Periods) : atr2up=src-(Multiplier*atr)up1 = nz(up[1],up)up := close[1] > up1 ? max(up,up1) : updn=src+(Multiplier*atr)dn1 = nz(dn[1], dn)dn := close[1] < dn1 ? min(dn, dn1) : dnwmaFastSource   = input(defval = close, title = "Fast WMA Source")wmaFastLength   = input(defval = 5, title = "Fast WMA Period")wmaSlowSource   = input(defval = close, title = "Slow WMA Source")wmaSlowLength   = input(defval = 20, title = "Slow WMA Period")wmaDirectionSource  = input(defval = close, title = "Trend 50 Period Source")wmaDirectionLength  = input(defval = 50, title = "Trend 50 Period")timeinrange(res, sess) => time(res, sess) != 0// === SERIES SETUP ===/// a couple of ma's..wmaFast = wma(close, 5)wmaSlow = wma(close, 20)wmaDirection = wma(close, 50)// === PLOTTING ===fast = plot(series=wmaFast, color=color.white, linewidth=2)slow = plot(series=wmaSlow, color=color.yellow, linewidth=2)direction = plot(series=wmaDirection, color=color.red, linewidth=2)// === INPUT BACKTEST RANGE ===//fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)//fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)//fromYear = input(defval = 2022, title = "From Year", minval = 2022) // To Date Inputs//toDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)//toMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)//toYear = input(defval = 2022, title = "To Year", minval = 2022)//startDate = timestamp(fromYear, fromMonth, fromDay)//finishDate = timestamp(toYear, toMonth, toDay)//inDateRange= (time >= fromDay, fromMonth, fromYear and time <= toDay, toMonth, toYear) // === FUNCTION EXAMPLE ===//inDateRange = (time >= fromDay, fromMonth, fromYear) and (time <= toDay, toMonth, toYear)// === LOGIC ===enterLong = crossover(wmaFast, wmaSlow) and close > wmaDirection and timeinrange(timeframe.period, "0900-1430")enterShort = crossunder(wmaFast, wmaSlow) and close < wmaDirection and timeinrange(timeframe.period, "0900-1430")//trend := nz(trend[1], trend)//trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend//upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)buySignal = enterLong //plotshape(enterLong ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green)plotshape(enterLong and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white)//dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)sellSignal = enterShort//plotshape(enterShort ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red)plotshape(enterShort and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white)//mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)//longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white//shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white//fill(mPlot, upPlot, title="UpTrend Highligter", color=longFillColor)//fill(mPlot, dnPlot, title="DownTrend Highligter", color=shortFillColor)alertcondition(buySignal, title="Buy", message="Buy!")alertcondition(sellSignal, title="Sell", message="Sell!")//changeCond = trend != trend[1]//alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend has changed direction!")// Entry for strategy ////tp=input(25,title="TakeProfit")//sl=input(40,title="StopLoss")//strategy.entry("Long",1, when=enterLong)//strategy.exit("Exit",profit=tp,loss=sl)//strategy.exit("TakeProfit",profit=tp)//strategy.exit("StopLoss",loss=sl)//strategy.entry("Short",1, when=enterShort)//strategy.exit("Exit",profit=tp,loss=sl)//strategy.exit("TakeProfit",profit=tp)//strategy.exit("StopLoss",loss=sl)//strategy.exit("Exit", wmaFastwmaSlow)//Buy and Sell Signals//strategy.close_all(when =not timeinrange(timeframe.period, "1000-1430"))   // === FILL ====fill (fast, slow, color = wmaSlow > wmaDirection ? color.green : color.red)//fill(when=enterLong, tp, color = color.new(color.green, 90), title = "Profit area")//fill(when=enterLong, sl, color = color.new(color.red, 90), title = "Loss area")//fill(when=enterShort, tp, color = color.new(color.green, 90), title = "Profit area")//fill(when=enterShort, sl, color = color.new(color.red, 90), title = "Loss area")