Appearance
Personalize your experience
Mode
Accent Color
Direction
Book RSI Reversal
FreeFades oversold price when the order book RSI shows strong bid support
0.0(0)
0 installs 0 0 commentsQ
quascriptstrategyorder-bookrsireversal
Live engine preview
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.
Book RSI 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 RSI is oversold while the order book RSI shows bids building (the book disagrees with the selling), sells the mirror. Exit at the RSI midline or an ATR stop. Needs the order book (L2): trades only on bars with a recorded book.
Settings
Band around mid (%): 0.25
Stop (ATR): 1.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 IDEquascript
| 1 | strategy "Book RSI 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 RSI is oversold while the order book RSI shows bids building (the book disagrees |
| 11 | /// with the selling), sells the mirror. Exit at the RSI midline or an ATR stop. |
| 12 | /// Needs the order book (L2): trades only on bars with a recorded book. |
| 13 | pct = param.float(0.25, title = "Band around mid (%)", min = 0.02, max = 5, step = 0.01) |
| 14 | stopk = param.float(1.5, title = "Stop (ATR)", min = 0.2, max = 10, step = 0.1) |
| 15 | b = book.liquidity(pct, book.bid_side) |
| 16 | a_ = book.liquidity(pct, book.ask_side) |
| 17 | d = math.coalesce((b - b[1]) - (a_ - a_[1]), 0) |
| 18 | brsi = 100 - 100 / (1 + ta.rma(math.max(d, 0), 14) / math.max(ta.rma(math.max(-d, 0), 14), 1e-12)) |
| 19 | r = ta.rsi(close, 14) |
| 20 | a = ta.atr(14) |
| 21 | flat = position.size == 0 |
| 22 | if flat and r < 30 and brsi > 55 and not math.is_na(a) and not math.is_na(b) { |
| 23 | order.market("L", side.long) |
| 24 | exit.bracket("L stop", entry = "L", stop = close - stopk * a) |
| 25 | } |
| 26 | if flat and r > 70 and brsi < 45 and not math.is_na(a) and not math.is_na(b) { |
| 27 | order.market("S", side.short) |
| 28 | exit.bracket("S stop", entry = "S", stop = close + stopk * a) |
| 29 | } |
| 30 | if position.size > 0 and r > 50 { exit.close_all() } |
| 31 | if position.size < 0 and r < 50 { exit.close_all() } |
| 32 | risk.max_drawdown(25) |
| 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.