Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesTrend Breakout (ATR)
QuaScript

Trend Breakout (ATR)

Free

Breakouts with ATR stops and targets

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

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

View Profile
quascriptstrategybreakout
Free
Backtest this strategy Open in QuaTick IDE 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.

Trend Breakout (ATR)engine 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

Donchian breakout in the direction of a 200-EMA trend filter. Size risks 1% of equity on an ATR stop; the target is `reward` times the risk and a trailing stop takes over after 1R.


Settings

Breakout length: 20

Trend EMA: 200

Stop (ATR): 2

Reward (R): 3


Measured backtests

Run by the backtest engine on public candles, 2025-11-01 to 2026-11-01, with the script's own commission and slippage, on BTCUSDT 1h (Binance) and ETHUSDT 1h (Binance). The figures per market are in the Measured backtest panel below. Past results do not predict future returns.


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

      Measured backtest

      BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included

      Backtest this strategy

      -11.7%

      Return

      -0.50

      Sharpe

      -25.1%

      Max DD

      25.5%

      Win Rate

      153

      Trades

      MarketTradesReturnSharpeMax DDWin rateProfit factor
      BTCUSDT 1h153-11.7%-0.50-25.1%25.5%0.91
      ETHUSDT 1h197-9.1%-0.28-23.9%25.9%0.94

      Past results on historical data do not predict future returns.

      Source Code

      Edit in IDE
      quascript
      1strategy "Trend Breakout (ATR)" {
      2 overlay = true
      3 capital = 100000
      4 commission = 0.05
      5 slippage = 1
      6 sizing = risk_percent
      7 size = 1
      8 pyramiding = 1
      9}
      10/// Donchian breakout in the direction of a 200-EMA trend filter. Size risks 1% of equity on an
      11/// ATR stop; the target is `reward` times the risk and a trailing stop takes over after 1R.
      12use "risk/position_sizing" as ps
      13 
      14len = param.int(20, title = "Breakout length", min = 5, max = 200)
      15trend = param.int(200, title = "Trend EMA", min = 20, max = 1000)
      16stop_k = param.float(2.0, title = "Stop (ATR)", min = 0.5, max = 10, step = 0.1)
      17reward = param.float(3.0, title = "Reward (R)", min = 0.5, max = 10, step = 0.1)
      18 
      19(_, upper, lower) = ta.donchian(len)
      20filter = ta.ema(close, trend)
      21a = ta.atr(14)
      22long_sig = close > upper[1] and close > filter
      23short_sig = close < lower[1] and close < filter
      24 
      25if position.size == 0 and long_sig {
      26 order.market("L", side.long)
      27 exit.bracket("L exit", entry = "L", stop = close - stop_k * a, target = close + stop_k * a * reward,
      28 trail_offset = stop_k * a, trail_trigger = close + stop_k * a)
      29}
      30if position.size == 0 and short_sig {
      31 order.market("S", side.short)
      32 exit.bracket("S exit", entry = "S", stop = close + stop_k * a, target = close - stop_k * a * reward,
      33 trail_offset = stop_k * a, trail_trigger = close - stop_k * a)
      34}
      35risk.max_drawdown(25)
      36risk.max_trades_per_day(4)
      37 
      38render.line(upper, "Upper", color = color.teal.500, width = 1)
      39render.line(lower, "Lower", color = color.rose.500, width = 1)
      40render.line(filter, "Trend filter", color = color.amber.400, width = 2)
      41render.mark(long_sig and position.size == 0, shape = shape.arrow_up, at = anchor.below_bar, color = color.teal.400, text = "Long")
      42render.mark(short_sig and position.size == 0, shape = shape.arrow_down, at = anchor.above_bar, color = color.rose.400, text = "Short")
      43 
      Read-only preview. Open in the QuaTick IDE 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.