Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesQueue Divergence Reversal
QuaScript

Queue Divergence Reversal

Admin's ChoiceFree

Reversals where touch queues built against the move (order book bars only)

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
quascriptstrategyorder-bookl1reversal
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.

Queue Divergence Reversalengine 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

Buys when price has fallen for several bars while the bid queue at the touch kept growing (support building) and the bar closes up; sells the mirror. Exit at a reward multiple or ATR stop. Needs the order book (L1): trades only on bars with a recorded book.


Settings

Decline bars: 4

Reward / risk: 1.5

Stop (ATR): 1.2


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 "Queue Divergence Reversal" {
      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/// Buys when price has fallen for several bars while the bid queue at the touch kept growing
      11/// (support building) and the bar closes up; sells the mirror. Exit at a reward multiple or ATR
      12/// stop. Needs the order book (L1): trades only on bars with a recorded book.
      13lb = param.int(4, title = "Decline bars", min = 2, max = 50)
      14rr = param.float(1.5, title = "Reward / risk", min = 0.5, max = 10, step = 0.1)
      15stopk = param.float(1.2, title = "Stop (ATR)", min = 0.2, max = 10, step = 0.1)
      16bp = book.bid
      17bq = book.bid_size
      18ap = book.ask
      19aq = book.ask_size
      20bid_flow = math.is_na(bp[1]) ? na : bp > bp[1] ? bq : bp < bp[1] ? -bq[1] : bq - bq[1]
      21ask_flow = math.is_na(ap[1]) ? na : ap < ap[1] ? aq : ap > ap[1] ? -aq[1] : aq - aq[1]
      22net = math.coalesce(bid_flow, 0) - math.coalesce(ask_flow, 0)
      23flow = stat.sum(net, lb)
      24a = ta.atr(14)
      25long_sig = not math.is_na(a) and close[1] < close[lb] and flow > 0 and close > open and not math.is_na(bp)
      26short_sig = not math.is_na(a) and close[1] > close[lb] and flow < 0 and close < open and not math.is_na(bp)
      27flat = position.size == 0
      28if flat and long_sig {
      29 order.market("L", side.long)
      30 exit.bracket("L exit", entry = "L", stop = close - stopk * a, target = close + rr * stopk * a)
      31}
      32if flat and short_sig {
      33 order.market("S", side.short)
      34 exit.bracket("S exit", entry = "S", stop = close + stopk * a, target = close - rr * stopk * a)
      35}
      36risk.max_drawdown(25)
      37render.mark(long_sig and flat, shape = shape.triangle_up, at = anchor.below_bar, color = color.teal.300, size = 0.6, title = "Bids building")
      38render.mark(short_sig and flat, shape = shape.triangle_down, at = anchor.above_bar, color = color.rose.300, size = 0.6, title = "Asks building")
      39 
      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.