Appearance
Personalize your experience
Mode
Accent Color
Direction
MACD Spectrum Alignment
FreeTrades when most of twelve MACD speeds agree
0.0(0)
0 installs 0 0 commentsQ
quascriptstrategymacdmomentum
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.
MACD Spectrum Alignmentengine 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
Enters when at least the required number of twelve MACD speeds agree on direction and exits when agreement falls below half of it, with an ATR stop.
Settings
Speeds required (of 12): 10
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 IDEquascript
| 1 | strategy "MACD Spectrum Alignment" { |
| 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 | /// Enters when at least the required number of twelve MACD speeds agree on direction and exits |
| 11 | /// when agreement falls below half of it, with an ATR stop. |
| 12 | need = param.int(10, title = "Speeds required (of 12)", min = 1, max = 12) |
| 13 | stopk = param.float(2.5, title = "Stop (ATR)", min = 0.5, max = 10, step = 0.1) |
| 14 | score = 0 |
| 15 | for f in [3, 5, 6, 8, 10, 12, 15, 18, 22, 27, 33, 40] { |
| 16 | (m, s, h) = ta.macd(close, f, f * 2 + 2, 9) |
| 17 | score := score + (h > 0 ? 1 : -1) |
| 18 | } |
| 19 | a = ta.atr(14) |
| 20 | flat = position.size == 0 |
| 21 | if flat and score >= need and not math.is_na(a) { |
| 22 | order.market("L", side.long) |
| 23 | exit.bracket("L stop", entry = "L", stop = close - stopk * a) |
| 24 | } |
| 25 | if flat and score <= -need and not math.is_na(a) { |
| 26 | order.market("S", side.short) |
| 27 | exit.bracket("S stop", entry = "S", stop = close + stopk * a) |
| 28 | } |
| 29 | if position.size > 0 and score < need / 2 { exit.close_all() } |
| 30 | if position.size < 0 and score > -need / 2 { exit.close_all() } |
| 31 | risk.max_drawdown(25) |
| 32 | render.candle_color(score >= need ? color.emerald.400 : score <= -need ? color.rose.400 : na) |
| 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.