Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesMACD Spectrum Alignment
QuaScript

MACD Spectrum Alignment

Free

Trades when most of twelve MACD speeds agree

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
quascriptstrategymacdmomentum
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.

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 IDE
      quascript
      1strategy "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.
      12need = param.int(10, title = "Speeds required (of 12)", min = 1, max = 12)
      13stopk = param.float(2.5, title = "Stop (ATR)", min = 0.5, max = 10, step = 0.1)
      14score = 0
      15for 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}
      19a = ta.atr(14)
      20flat = position.size == 0
      21if 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}
      25if 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}
      29if position.size > 0 and score < need / 2 { exit.close_all() }
      30if position.size < 0 and score > -need / 2 { exit.close_all() }
      31risk.max_drawdown(25)
      32render.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.