GOLDM Dow Theory – 1H Trend + 5m Pullback

Instrument: MCX GOLDM
Chart timeframe: 5 minutes
Side: Long-only
Position size: Fixed 3 lots
Core idea:
Trade only in 1H uptrend, enter after a 5m pullback and breakout, with basic volume/volatility filters and ATR-based SL/TP.
2. High-Level Logic Flow (Per Bar)
On every 5-minute bar, the script does this:
Update session/time, volume, and ATR filters
Read 1H trend from higher timeframe
Update 5m pullback state (whether a valid dip happened)
Check if there is a valid breakout back in the direction of the 1H trend
If all filters + conditions align → enter Long (3 lots)
While in a trade:
Manage SL/TP using ATR
Close trade if 1H trend flips down or price closes below 5m EMA
Everything else (plots, alerts) is just for visibility and convenience.
3. Inputs & Configuration
Main inputs:
pullbackLookback – how many 5m bars to look back to detect a pullback
breakoutLookback – how many bars to consider for recent swing high
emaLenTrendFast / emaLenTrendSlow – 1H EMAs (50/200) for trend
emaLenPullback – 5m EMA used for pullback logic (default 20)
tradeSession – default "0900-2315" (you can change)
volLookback, volMult – volume filter
atrLen, atrSmaLen – ATR filter
slATRmult (1.4), tpATRmult (3.0) – ATR multiples → ~1.4 : 3 RR
4. Session / Time Filter
tradeSession = "0900-2315"
inSession = not useSessionFilter or not na(time(timeframe.period, tradeSession))
Only allows entries when the current bar’s time is inside 09:00–23:15.
If useSessionFilter is false, this filter is ignored.
No trade opens outside this window, but existing trades can still exit.
5. Volume & Volatility Filters
Volume Filter
avgVol = ta.sma(volume, volLookback)
highVolume = not useVolumeFilter or (volume > avgVol * volMult)
If enabled, current bar’s volume must be greater than average volume × multiplier.
Purpose: avoid thin, illiquid periods.
ATR Filter
atr5 = ta.atr(atrLen)
atrSma = ta.sma(atr5, atrSmaLen)
goodATR = not useATRFilter or (atr5 > atrSma)
If enabled, current ATR must be above its own moving average.
Purpose: avoid flat / extremely low-volatility periods.
Only if both highVolume and goodATR are true, the system considers entering.
6. Higher Timeframe Trend (1H)
emaFast1h = request.security(syminfo.tickerid, "60", ta.ema(close, emaLenTrendFast), ...)
emaSlow1h = request.security(syminfo.tickerid, "60", ta.ema(close, emaLenTrendSlow), ...)
trendUp = emaFast1h > emaSlow1h
trendDown = emaFast1h < emaSlow1h
On the 1-hour timeframe:
If EMA Fast (50) > EMA Slow (200) → trendUp = true
If EMA Fast (50) < EMA Slow (200) → trendDown = true
This is the core trend filter:
We only look for longs when trendUp is true.
7. 5-Minute Structure Logic (Dow-style)
7.1 Pullback Detection
emaPull = ta.ema(close, emaLenPullback)
pulledBackLong = ta.lowest(close, pullbackLookback) < emaPull
A pullback is defined as:
In the last pullbackLookback bars, price closed below the 5m EMA (emaPull) at least once.
This indicates a dip against the 1H uptrend.
A state flag tracks this:
var bool hadLongPullback = false
hadLongPullback := trendUp and pulledBackLong ? true : (not trendUp ? false : hadLongPullback)
When:
trendUp AND pulledBackLong → hadLongPullback = true.
If the trend stops being up (trendUp = false), flag resets to false.
So the system remembers:
“There has been a proper dip while the 1H uptrend is active.”
7.2 Breakout Confirmation
recentHigh = ta.highest(high, pullbackLookback)
breakoutUp = close > recentHigh[1]
After a pullback, we wait for price to close above the highest high of recent bars (excluding the current one).
This mimics:
“Higher high after a higher low” → breakout in Dow Theory terms.
8. Final Long Entry Logic
The base entry condition:
baseLongEntry =
trendUp and
hadLongPullback and
breakoutUp and
close > emaPull
Translated:
1H trend is up (trendUp).
A valid pullback happened recently (hadLongPullback).
Current candle broke above the recent swing high (breakoutUp).
Price is now back above the 5m EMA (pullback is resolving, not deepening).
Then filters are applied:
longEntryCond =
baseLongEntry and
inSession and
highVolume and
goodATR and
not isLong
So a long entry only occurs if:
Core structure conditions (baseLongEntry) are true
Time is within session
Volume is high enough
ATR is healthy
You are not already in a long
When longEntryCond is true:
if longEntryCond
strategy.entry("Long", strategy.long, comment = "Dow Long: Trend+PB+BO")
hadLongPullback := false
Enters 3 lots long (as per default_qty_type + default_qty_value).
Resets hadLongPullback so we don’t re-use the same pullback.
9. Exit Logic
There are two exit layers:
9.1 Logical Exit (Trend or Structure Change)
exitLongTrendFlip = trendDown
exitLongEMA = ta.crossunder(close, emaPull)
longExitCond = isLong and (exitLongTrendFlip or exitLongEMA)
If in a long:
Exit when trend flips down (1H EMA50 < EMA200), OR
Price crosses below 5m EMA (pullback may be turning into reversal).
Then:
if longExitCond
strategy.close("Long", comment = "Exit Long: Trend flip / EMA break")
This closes the position at market (on bar close).
9.2 ATR-based Stop Loss & Take Profit
if useSLTP and isLong
longStop = strategy.position_avg_price - atr5 * slATRmult
longLimit = strategy.position_avg_price + atr5 * tpATRmult
strategy.exit("Long SLTP", "Long", stop = longStop, limit = longLimit)
SL = entry price – 1.4 × ATR(14, 5m)
TP = entry price + 3.0 × ATR(14, 5m)
This gives roughly 1.4 : 3 RR.
If SL or TP is hit, strategy.exit will close the trade.
So exits can come from:
Hitting Stop Loss
Hitting Take Profit
OR logic-based exit (trend flip / EMA break)
10. Alerts
Two alertconditions:
alertcondition(longEntryCond, title="Long Entry Signal",
message="GOLDM LONG: 1H Uptrend + 5m Pullback Breakout + Filters OK")
alertcondition(longExitCond, title="Long Exit Signal",
message="GOLDM LONG EXIT: Trend flip or EMA break")
You can set TradingView alerts based on:
“Long Entry Signal” → tells you when all entry conditions align.
“Long Exit Signal” → tells you when the logic-based exit triggers.
(ATR SL/TP exits won’t auto-alert unless you separately set price alerts or add extra conditions.)
11. Mental Model Summary (How YOU should think about it)
For every trade, the system is basically doing this:
Is GOLDM in an uptrend on 1H?
→ If no: do nothing
Did we get a clear dip below 5m EMA in that uptrend?
→ If no: wait
Did price then break above recent highs and reclaim EMA20?
→ If yes: this is our Dow-style continuation entry
Is market liquid and moving (volume + ATR)?
→ If yes: go Long with 3 lots
Manage with:
ATR SL & TP
Exit early if 1H trend flips or price falls back below EMA20
نص برمجي للمستخدمين المدعوين فقط
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact phantomscharts directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
تعليمات المؤلف
إخلاء المسؤولية
نص برمجي للمستخدمين المدعوين فقط
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact phantomscharts directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.