Page 4 of 4

Re: News-based scalping: how do you trade NFP/CPI releases?

Posted: Mon Sep 07, 2026 9:47 pm
by PTScalper
Integrating with the Execution Engine

Now, we modify the entry logic from the previous script to enforce the regime alignment before firing the continuation trade. We also add a directional lock so we don't accidentally take a short continuation setup in a bullish 4-hour regime.

Code: Select all

// =========================================================================
// UPDATED EXECUTION ENGINE (With MTF Filter)
// =========================================================================

// Entry Engine
if state == MarketState.PostNewsWindow and struct.isLocked and strategy.position_size == 0
    
    // Evaluate Long Setup
    bool inDiscountZoneLong = close > struct.fib618 and low <= struct.fib50
    bool isTrendAlignedLong = htfTrend == Regime.Bullish
    
    if inDiscountZoneLong and isSpreadTight and isTrendAlignedLong and lotSize > 0
        strategy.entry("Macro_Cont_Long", strategy.long, qty=lotSize)
        strategy.exit("Macro_Risk", "Macro_Cont_Long", stop=close - stopDist, limit=struct.impHigh)
        tradeStartTime := currMins

    // (Optional) Evaluate Short Setup using the same logic inverted
    // bool inPremiumZoneShort = close < struct.fib618 and high >= struct.fib50
    // bool isTrendAlignedShort = htfTrend == Regime.Bearish
    // if inPremiumZoneShort and isSpreadTight and isTrendAlignedShort...

Re: News-based scalping: how do you trade NFP/CPI releases?

Posted: Mon Sep 07, 2026 9:47 pm
by PTScalper
Updating the Dashboard

To ensure you always know what regime the algorithm is reading in real-time, you can append the HTF state to your v6 dashboard table:

Code: Select all

if barstate.islast
    // ... existing table cells ...
    table.cell(dash, 0, 2, "4H Macro Regime:", text_color=color.gray)
    
    color regimeColor = htfTrend == Regime.Bullish ? color.green : htfTrend == Regime.Bearish ? color.red : color.gray
    table.cell(dash, 1, 2, str.tostring(htfTrend), text_color=regimeColor, text_formatting=text.format_bold)

Re: News-based scalping: how do you trade NFP/CPI releases?

Posted: Mon Sep 07, 2026 9:48 pm
by PTScalper
Why this specific implementation matters:

By isolating getHtfRegime()[1] with lookahead=barmerge.lookahead_on, you force the script to ask: "What was the 4-hour trend state at the exact millisecond before the 08:30 CPI candle opened?"

If you are scalping the 1-minute or 5-minute chart during the digest, the algorithm will hold that pre-news 4H bias constant, allowing you to confidently trade the structural 50% retrace in the direction of the dominant institutional flow.