Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesZero-Lag Trend
QuaScript

Zero-Lag Trend

Free

Zero-lag EMA cross trend entries filtered by slow regime baseline

0.0(0)
0 installs 0 0 comments
Q
433 listings

The QuaTick team's QuaScript analyses, run by the native C++ engine.

View Profile
quascriptstrategyemazero-lagtrend
Free
Backtest this strategy Open in QuaCode Edit in IDE
Version
Updated
Compatible

Live engine preview

QuaScriptQuaScript

The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.

Zero-Lag Trendengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

About

Trades crosses of a zero-lag EMA over a regular EMA in the direction of a slow EMA, with an ATR stop and an exit on the opposite cross.


Settings

Length: 34

Trend filter: 200

Stop (ATR): 2.5


Backtest it yourself

Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.

Strategy Rules

Entry Conditions

    Exit Conditions

      Source Code

      Edit in IDE
      quascript
      1strategy "Zero-Lag Trend" {
      2 overlay = true
      3 capital = 100000
      4 commission = 0.05
      5 slippage = 1
      6 sizing = risk_percent
      7 size = 1
      8 max_leverage = 1
      9}
      10/// Trades crosses of a zero-lag EMA over a regular EMA in the direction of a slow EMA, with an ATR
      11/// stop and an exit on the opposite cross.
      12len = param.int(34, title = "Length", min = 2, max = 500)
      13trend = param.int(200, title = "Trend filter", min = 10, max = 2000)
      14stopk = param.float(2.5, title = "Stop (ATR)", min = 0.5, max = 10, step = 0.1)
      15z = ta.zero_lag(close, len)
      16e = ta.ema(close, len)
      17t = ta.ema(close, trend)
      18a = ta.atr(14)
      19flat = position.size == 0
      20if flat and ta.cross_up(z, e) and close > t and not math.is_na(a) {
      21 order.market("L", side.long)
      22 exit.bracket("L stop", entry = "L", stop = close - stopk * a)
      23}
      24if flat and ta.cross_down(z, e) and close < t and not math.is_na(a) {
      25 order.market("S", side.short)
      26 exit.bracket("S stop", entry = "S", stop = close + stopk * a)
      27}
      28if position.size > 0 and ta.cross_down(z, e) { exit.close_all() }
      29if position.size < 0 and ta.cross_up(z, e) { exit.close_all() }
      30risk.max_drawdown(25)
      31render.line(z, "Zero-lag", color = color.cyan.300, width = 1.5)
      32render.line(t, "Trend filter", color = color.translucent(color.slate.300, 40), width = 1)
      33 
      Read-only preview. Open in QuaCode to edit and deploy.

      Reviews

      No reviews yet. Be the first to review this listing.

      Discussion

      Sign in to join the discussion. Your posts and replies show up on your profile.