Appearance
Personalize your experience
Mode
Accent Color
Direction
VIDYA Range Fade
FreeFades rejections of VIDYA bands while volatility index indicates range regime
0.0(0)
0 installs 0 0 commentsQ
quascriptstrategyvidyarangemean-reversion
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.
VIDYA Range Fadeengine 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
Fades rejections of the VIDYA bands while VIDYA is flat (a range), targeting VIDYA itself.
Settings
Length: 20
Band (ATR): 1.5
Stop beyond band (ATR): 1
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 "VIDYA Range Fade" { |
| 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 | /// Fades rejections of the VIDYA bands while VIDYA is flat (a range), targeting VIDYA itself. |
| 11 | len = param.int(20, title = "Length", min = 2, max = 500) |
| 12 | mult = param.float(1.5, title = "Band (ATR)", min = 0.2, max = 10, step = 0.1) |
| 13 | stopk = param.float(1.0, title = "Stop beyond band (ATR)", min = 0.1, max = 10, step = 0.1) |
| 14 | v = ta.vidya(close, len, 9) |
| 15 | a = ta.atr(14) |
| 16 | flat_v = math.abs(v - v[5]) / math.max(a, 1e-12) < 0.5 |
| 17 | up = v + mult * a |
| 18 | dn = v - mult * a |
| 19 | flat = position.size == 0 |
| 20 | if flat and flat_v and high > up and close < up and not math.is_na(a) { |
| 21 | order.market("S", side.short) |
| 22 | exit.bracket("S exit", entry = "S", stop = up + stopk * a, target = v) |
| 23 | } |
| 24 | if flat and flat_v and low < dn and close > dn and not math.is_na(a) { |
| 25 | order.market("L", side.long) |
| 26 | exit.bracket("L exit", entry = "L", stop = dn - stopk * a, target = v) |
| 27 | } |
| 28 | risk.max_drawdown(25) |
| 29 | pu = render.line(up, "Upper", color = color.translucent(color.violet.300, 40), width = 1) |
| 30 | render.line(v, "VIDYA", color = color.amber.300, width = 1.5) |
| 31 | pd = render.line(dn, "Lower", color = color.translucent(color.violet.300, 40), width = 1) |
| 32 | render.band(pu, pd, color = color.violet.500, opacity = 0.06, title = "Band") |
| 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.