Systematic refinement of the 15-minute DI Cross entry system for FCPO (Bursa Malaysia CPO Futures). Testing filter combinations to isolate quality DI cross signals and improve profit factor above 1.5+. 23 variants tested · current best: W15-S (PF 1.562, WR 45.61%)
//@version=6
strategy("W15-S — M15 DI Cross (ADX>18, H1+H4 DI, D1 EMA200)", shorttitle="W15-S",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
[plusDI, minusDI, adx] = ta.dmi(14, 14)
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
longSig = ta.crossover(plusDI, minusDI) and adx > 18
and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and strategy.position_size == 0
shortSig = ta.crossover(minusDI, plusDI) and adx > 18
and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)Structural incompatibility: ADX(14) lookback too short, 2-hour session too short for ATR-based TP targets, RM30 commission too large relative to smaller TF moves.
Recommendation: Do not waste further testing cycles on DI cross below M15. If intraday precision is needed, use M15 for signal direction and manual sub-bar entry timing.
//@version=6
strategy("W16-I — M15 EMA21 Pullback + DI Spread (ADX>18, H1+H4 DI, D1 EMA200)", shorttitle="W16-I",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
[plusDI, minusDI, adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2]
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
longSig = low <= ema21 and close > ema21 and close > ema50
and spreadExpanding and plusDI > minusDI and adx > 18
and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and strategy.position_size == 0
shortSig = high >= ema21 and close < ema21 and close < ema50
and spreadExpanding and minusDI > plusDI and adx > 18
and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)//@version=6
strategy("W17-M — M5 EMA21 PB Both Sessions (M5/M15 DI + H1+H4+D1)", shorttitle="W17-M",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
[plusDI, minusDI, _adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2]
f_m15spread() =>
[p, m, _] = ta.dmi(14, 14)
math.abs(p - m)
m15SpreadNow = request.security(syminfo.tickerid, "15", f_m15spread(), gaps=barmerge.gaps_off)
m15Spread3 = request.security(syminfo.tickerid, "15", f_m15spread()[3], gaps=barmerge.gaps_off)
m15SpreadExp = m15SpreadNow > m15Spread3
[m15Plus, m15Minus, _m15adx] = request.security(syminfo.tickerid, "15", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
longSig = low <= ema21 and close > ema21 and close > ema50
and spreadExpanding and plusDI > minusDI
and m15SpreadExp and m15Plus > m15Minus
and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and strategy.position_size == 0
shortSig = high >= ema21 and close < ema21 and close < ema50
and spreadExpanding and minusDI > plusDI
and m15SpreadExp and m15Minus > m15Plus
and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)//@version=6
strategy("W18-H — M5 EMA21 PB PM Session (M5 DI, M15 Direction, H1+H4+D1)", shorttitle="W18-H",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
[plusDI, minusDI, _adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2]
[m15Plus, m15Minus, _m15adx] = request.security(syminfo.tickerid, "15", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
inSession = not na(time("5", "1430-1800:23456"))
longSig = low <= ema21 and close > ema21 and close > ema50
and spreadExpanding and plusDI > minusDI
and m15Plus > m15Minus and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and inSession and strategy.position_size == 0
shortSig = high >= ema21 and close < ema21 and close < ema50
and spreadExpanding and minusDI > plusDI
and m15Minus > m15Plus and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and inSession and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)//@version=6
strategy("W19-F — M5 EMA34 PB PM Session (M5/M15 DI, H1+H4+D1)", shorttitle="W19-F",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
ema34 = ta.ema(close, 34)
ema50 = ta.ema(close, 50)
[plusDI, minusDI, _adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2]
[m15Plus, m15Minus, _m15adx] = request.security(syminfo.tickerid, "15", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
inSession = not na(time("5", "1430-1800:23456"))
longSig = low <= ema34 and close > ema34 and close > ema50
and spreadExpanding and plusDI > minusDI
and m15Plus > m15Minus and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and inSession and strategy.position_size == 0
shortSig = high >= ema34 and close < ema34 and close < ema50
and spreadExpanding and minusDI > plusDI
and m15Minus > m15Plus and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and inSession and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)//@version=6
strategy("W20-D — M5 EMA34 PB + Slope[3] PM (M5/M15 DI, H1+H4+D1)", shorttitle="W20-D",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
ema34 = ta.ema(close, 34)
ema50 = ta.ema(close, 50)
[plusDI, minusDI, _adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2]
[m15Plus, m15Minus, _m15adx] = request.security(syminfo.tickerid, "15", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h1Plus, h1Minus, _h1adx] = request.security(syminfo.tickerid, "60", ta.dmi(14,14), gaps=barmerge.gaps_off)
[h4Plus, h4Minus, _h4adx] = request.security(syminfo.tickerid, "240", ta.dmi(14,14), gaps=barmerge.gaps_off)
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
inSession = not na(time("5", "1430-1800:23456"))
ema34Rising = ema34 > ema34[3]
ema34Falling = ema34 < ema34[3]
longSig = low <= ema34 and close > ema34 and ema34Rising and close > ema50
and spreadExpanding and plusDI > minusDI
and m15Plus > m15Minus and h1Plus > h1Minus and h4Plus > h4Minus
and close > ema200d and inSession and strategy.position_size == 0
shortSig = high >= ema34 and close < ema34 and ema34Falling and close < ema50
and spreadExpanding and minusDI > plusDI
and m15Minus > m15Plus and h1Minus > h1Plus and h4Minus > h4Plus
and close < ema200d and inSession and strategy.position_size == 0
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)//@version=6
strategy("W21-O Production — M5 EMA34 Triple Slope PM", shorttitle="W21-O",
overlay=true, initial_capital=500000,
default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=30,
slippage=1, pyramiding=0, process_orders_on_close=true)
fixedTP = input.int(50, "Fixed TP (points)")
fixedSL = input.int(20, "Fixed SL (points)")
// ── Entry EMA ──────────────────────────────────────────────────────────────
ema34 = ta.ema(close, 34)
// ── M5 DI ──────────────────────────────────────────────────────────────────
[plusDI, minusDI, _adx] = ta.dmi(14, 14)
diSpread = math.abs(plusDI - minusDI)
spreadExpanding = diSpread > diSpread[2] // expanding over last 10 min
// ── M15 ────────────────────────────────────────────────────────────────────
[m15Plus, m15Minus, _m15adx] = request.security(syminfo.tickerid, "15", ta.dmi(14,14), gaps=barmerge.gaps_off)
m15ema34 = request.security(syminfo.tickerid, "15", ta.ema(close, 34), gaps=barmerge.gaps_off)
m15ema34_3 = request.security(syminfo.tickerid, "15", ta.ema(close, 34)[3], gaps=barmerge.gaps_off)
// ── H4 ─────────────────────────────────────────────────────────────────────
h4ema34 = request.security(syminfo.tickerid, "240", ta.ema(close, 34), gaps=barmerge.gaps_off)
h4ema34_5 = request.security(syminfo.tickerid, "240", ta.ema(close, 34)[5], gaps=barmerge.gaps_off)
// ── D1 ─────────────────────────────────────────────────────────────────────
ema200d = request.security(syminfo.tickerid, "D", ta.ema(close, 200), gaps=barmerge.gaps_off)
// ── Session ────────────────────────────────────────────────────────────────
inSession = not na(time("5", "1430-1800:23456")) // PM session 14:30–18:00 MYT Mon–Fri
// ── Slope gates ────────────────────────────────────────────────────────────
ema34Rising = ema34 > ema34[3] // M5 EMA34 rising over 15 min
ema34Falling = ema34 < ema34[3]
m15Rising = m15ema34 > m15ema34_3 // M15 EMA34 rising over 45 min
m15Falling = m15ema34 < m15ema34_3
h4Rising = h4ema34 > h4ema34_5 // H4 EMA34 rising over 20 hours
h4Falling = h4ema34 < h4ema34_5
// ── Signals ────────────────────────────────────────────────────────────────
longSig = low <= ema34 and close > ema34 and ema34Rising and m15Rising and h4Rising
and spreadExpanding and plusDI > minusDI and m15Plus > m15Minus
and close > ema200d and inSession and strategy.position_size == 0
shortSig = high >= ema34 and close < ema34 and ema34Falling and m15Falling and h4Falling
and spreadExpanding and minusDI > plusDI and m15Minus > m15Plus
and close < ema200d and inSession and strategy.position_size == 0
// ── Entries & Exits ────────────────────────────────────────────────────────
if longSig
strategy.entry("L", strategy.long)
strategy.exit("LX", "L", stop=close - fixedSL, limit=close + fixedTP)
if shortSig
strategy.entry("S", strategy.short)
strategy.exit("SX", "S", stop=close + fixedSL, limit=close - fixedTP)strategy_tests table once live. Not financial advice.Amaran Risiko: Dagangan niaga hadapan (futures) melibatkan risiko kerugian yang tinggi dan tidak sesuai untuk semua pelabur. Kerugian boleh melebihi deposit margin asal anda. Prestasi lampau bukan jaminan prestasi masa hadapan. Kandungan di laman ini adalah untuk tujuan pendidikan dan maklumat sahaja, dan bukan nasihat pelaburan. Pastikan anda memahami sepenuhnya risiko yang terlibat sebelum berdagang, dan dapatkan nasihat profesional jika perlu.