P404 Smoke is a price-chart strategy that sequences an optional higher-timeframe EMA bias, a liquidity range from recent pivots, a sweep of buy-side or sell-side liquidity, and a market structure shift within a set bar window.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
132 lines of Pine Script v5 from indicator/PHASE404_Strategy_Smoke.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
PHASE404_Strategy_Smoke.pine
//@version=5
// Minimal smoke strategy aligned with PHASE404 playbook:
// HTF bias (optional) → liquidity range → sweep → MSS → OTE 0.618–0.786 → confirm with candle.
// Exits on opposite signal only (no ATR/EMA/ADX layers).
strategy("P404 Smoke", shorttitle="P404⚙", overlay=true,
initial_capital=100000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=10,
commission_type=strategy.commission.percent,
commission_value=0.05,
pyramiding=0,
process_orders_on_close=true)
grp_htf = "HTF bias (optional)"
use_htf = input.bool(false, "Filter by higher timeframe trend", group=grp_htf,
tooltip="Rough 4H bias: price vs EMA. Chart can be 15m; playbook uses 4H/1D for direction.")
htf_tf = input.timeframe("240", "Higher timeframe", group=grp_htf)
htf_ema = input.int(20, "HTF EMA length", group=grp_htf, minval=2)
grp_liq = "Liquidity"
liq_lb = input.int(30, "Lookback (bars)", group=grp_liq, minval=5, maxval=200)
grp_mss = "MSS"
mss_len = input.int(5, "Swing length", group=grp_mss, minval=2, maxval=20)
mss_grab_max = input.int(120, "Max bars: liquidity grab → MSS", group=grp_mss, minval=5, maxval=500)
grp_flt = "Filters (match v2 indicator)"
req_kz = input.bool(false, "Require London or NY session", group=grp_flt,
tooltip="Playbook is discretionary on time; default off so entries are not session-gated.")
ote_slack_ticks = input.int(2, "OTE band slack (ticks)", group=grp_flt, minval=0, maxval=50)
grp_kz = "Kill zones (if required)"
kz_london = input.bool(true, "London 02–05 NY", group=grp_kz)
kz_ny = input.bool(true, "NY 07–10 NY", group=grp_kz)
kz_tz = input.string("America/New_York", "Timezone", group=grp_kz)
grp_run = "Run"
show_sig = input.bool(true, "Enable entries", group=grp_run)
ph(len) => ta.pivothigh(high, len, len)
pl(len) => ta.pivotlow(low, len, len)
isBull = close > open
isBear = close < open
// HTF bias (non-repainting request)
htf_ema_v = request.security(syminfo.tickerid, htf_tf, ta.ema(close, htf_ema), barmerge.gaps_off, barmerge.lookahead_off)
htf_c = request.security(syminfo.tickerid, htf_tf, close, barmerge.gaps_off, barmerge.lookahead_off)
htf_long_ok = not use_htf or htf_c > htf_ema_v
htf_short_ok = not use_htf or htf_c < htf_ema_v
var float bslPrice = na
var float sslPrice = na
_ph = ph(liq_lb / 3)
_pl = pl(liq_lb / 3)
if not na(_ph)
bslPrice := _ph
if not na(_pl)
sslPrice := _pl
bsl_swept = not na(bslPrice) and high > bslPrice and close < bslPrice
ssl_swept = not na(sslPrice) and low < sslPrice and close > sslPrice
var int last_bsl_grab_bi = na
var int last_ssl_grab_bi = na
if bsl_swept
last_bsl_grab_bi := bar_index
if ssl_swept
last_ssl_grab_bi := bar_index
var float mss_high_ref = na
var float mss_low_ref = na
_mph = ph(mss_len)
_mpl = pl(mss_len)
if not na(_mph)
mss_high_ref := _mph
if not na(_mpl)
mss_low_ref := _mpl
bull_mss_struct = not na(mss_high_ref) and close > mss_high_ref and close[1] <= mss_high_ref
bear_mss_struct = not na(mss_low_ref) and close < mss_low_ref and close[1] >= mss_low_ref
bars_since_ssl_grab = not na(last_ssl_grab_bi) ? bar_index - last_ssl_grab_bi : 100000000
bars_since_bsl_grab = not na(last_bsl_grab_bi) ? bar_index - last_bsl_grab_bi : 100000000
bull_mss_valid = bull_mss_struct and not na(last_ssl_grab_bi) and last_ssl_grab_bi < bar_index and bars_since_ssl_grab <= mss_grab_max
bear_mss_valid = bear_mss_struct and not na(last_bsl_grab_bi) and last_bsl_grab_bi < bar_index and bars_since_bsl_grab <= mss_grab_max
var float ote_top_active = na
var float ote_bot_active = na
var bool ote_is_bull = false
var bool ote_bull_pending = false
var bool ote_bear_pending = false
if bull_mss_valid and not na(sslPrice) and not ote_bull_pending[1]
r = close - sslPrice
ote_top_active := close - r * 0.618
ote_bot_active := close - r * 0.786
ote_is_bull := true
ote_bull_pending := true
ote_bear_pending := false
if bear_mss_valid and not na(bslPrice) and not ote_bear_pending[1]
r = bslPrice - close
ote_top_active := close + r * 0.786
ote_bot_active := close + r * 0.618
ote_is_bull := false
ote_bear_pending := true
ote_bull_pending := false
kz_hr = hour(time, kz_tz)
in_london = kz_london and kz_hr >= 2 and kz_hr < 5
in_ny = kz_ny and kz_hr >= 7 and kz_hr < 10
in_kz = in_london or in_ny
ote_slack = ote_slack_ticks * syminfo.mintick
in_ote_bull = not na(ote_top_active) and ote_is_bull and low <= ote_top_active + ote_slack and high >= ote_bot_active - ote_slack
in_ote_bear = not na(ote_top_active) and not ote_is_bull and high >= ote_bot_active - ote_slack and low <= ote_top_active + ote_slack
kz_ok = not req_kz or in_kz
long_signal = show_sig and in_ote_bull and isBull and kz_ok and htf_long_ok
short_signal = show_sig and in_ote_bear and isBear and kz_ok and htf_short_ok
if long_signal
ote_bull_pending := false
strategy.entry("LONG", strategy.long)
if short_signal
ote_bear_pending := false
strategy.entry("SHORT", strategy.short)
plotshape(long_signal, "LONG", shape.triangleup, location.belowbar, size=size.tiny, color=color.new(#00E676, 35))
plotshape(short_signal, "SHORT", shape.triangledown, location.abovebar, size=size.tiny, color=color.new(#FF1744, 35))
Overview
Comments state it then looks for an optimal trade entry band and a confirming candle before enabling entries. Position size is a percent of equity. It closes only on the opposite signal and has no stop loss by default. Main settings change the higher timeframe, pivot lookbacks, session gates, and whether entries run.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Filter by higher timeframe trend
bool
false
use_htf
Higher timeframe
timeframe
240
htf_tf
HTF EMA length
int
20
htf_ema
Lookback (bars)
int
30
liq_lb
Swing length
int
5
mss_len
Max bars: liquidity grab → MSS
int
120
mss_grab_max
Require London or NY session
bool
false
req_kz
OTE band slack (ticks)
int
2
ote_slack_ticks
London 02–05 NY
bool
true
kz_london
NY 07–10 NY
bool
true
kz_ny
Timezone
string
America/New_York
kz_tz
Enable entries
bool
true
show_sig
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This futures trading strategy combines Fair Value Gap (FVG) detection filtered by Average True Range (ATR) with multi-timeframe Exponential Moving Averages (8, 55, and 165 lengths). It identifies entry setups during a defined intraday trading session window wh
This overlay strategy plots previous-day high and low, the daily open, and fair value gap zones on the price chart. It takes entries on a selectable timeframe when the FVG requirement and an optional session window allow them, then uses an ATR or fixed pip sto
This strategy measures the distance between the current price and the opposite end of the latest fair value gap, entering trades on the expectation that price will fill the gap. It plots signals and execution levels directly on the price chart. Users can confi
This multi-timeframe scalping strategy plots moving averages alongside Smart Money Concepts elements on the price chart. It calculates trend signals using configurable moving average types like ALMA, Hull MA, or TEMA across alternate timeframes. It also plots
This overlay strategy tracks the high and low of a user-defined London session and plots the previous session levels as support and resistance. It flags a break beyond a level when price closes past an ATR buffer, then waits a set number of bars for a retest w
This strategy combines Opening Range Breakout (ORB) mechanics with Inner Circle Trader (ICT) concepts like Fair Value Gaps, Order Blocks, and liquidity grabs. It identifies session opening ranges and generates signals when price breaks out with supporting rela