OPEN-SOURCE SCRIPT
Forever Model [Pro+] (Sniper) Blueprint

//version=5
indicator("Forever Model Replica", overlay=true, dynamic_requests=true)
// Inputs
nasdaq = input.string("NASDAQ:NDX", "Nasdaq Symbol")
dow = input.string("DJ:DJI", "Dow Jones Symbol")
sp500 = input.string("SP:SPX", "S&P 500 Symbol")
fvg_min_range = input.float(0.5, "Min FVG Range (% of ATR)", minval=0.1)
bias = input.string("Neutral", "Directional Bias", options=["Bullish", "Bearish", "Neutral"])
session_filter = input.bool(true, "Filter by US Session (9 AM–5 PM UTC)")
start_hour = input.int(9, "Start Hour (UTC)", minval=0, maxval=23)
end_hour = input.int(17, "End Hour (UTC)", minval=0, maxval=23)
// ATR and Time Filter
atr = ta.atr(14)
in_time_window = not session_filter or (hour >= start_hour and hour <= end_hour)
// Arrays for active zones (FVGs and OBs)
var active_tops = array.new_float(0)
var active_bottoms = array.new_float(0)
var active_types = array.new_string(0)
var active_boxes = array.new_box(0)
// Pre-fetch price data for 14 bars for each timeframe
var float[] high_series_1h = array.new_float(14)
var float[] low_series_1h = array.new_float(14)
var float[] high_series_4h = array.new_float(14)
var float[] low_series_4h = array.new_float(14)
var float[] high_series_d = array.new_float(14)
var float[] low_series_d = array.new_float(14)
array.set(high_series_1h, 0, request.security(syminfo.tickerid, "60", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 0, request.security(syminfo.tickerid, "60", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 1, request.security(syminfo.tickerid, "60", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 1, request.security(syminfo.tickerid, "60", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 2, request.security(syminfo.tickerid, "60", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 2, request.security(syminfo.tickerid, "60", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 3, request.security(syminfo.tickerid, "60", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 3, request.security(syminfo.tickerid, "60", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 4, request.security(syminfo.tickerid, "60", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 4, request.security(syminfo.tickerid, "60", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 5, request.security(syminfo.tickerid, "60", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 5, request.security(syminfo.tickerid, "60", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 6, request.security(syminfo.tickerid, "60", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 6, request.security(syminfo.tickerid, "60", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 7, request.security(syminfo.tickerid, "60", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 7, request.security(syminfo.tickerid, "60", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 8, request.security(syminfo.tickerid, "60", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 8, request.security(syminfo.tickerid, "60", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 9, request.security(syminfo.tickerid, "60", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 9, request.security(syminfo.tickerid, "60", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 10, request.security(syminfo.tickerid, "60", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 10, request.security(syminfo.tickerid, "60", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 11, request.security(syminfo.tickerid, "60", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 11, request.security(syminfo.tickerid, "60", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 12, request.security(syminfo.tickerid, "60", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 12, request.security(syminfo.tickerid, "60", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 13, request.security(syminfo.tickerid, "60", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 13, request.security(syminfo.tickerid, "60", low[13], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 0, request.security(syminfo.tickerid, "240", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 0, request.security(syminfo.tickerid, "240", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 1, request.security(syminfo.tickerid, "240", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 1, request.security(syminfo.tickerid, "240", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 2, request.security(syminfo.tickerid, "240", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 2, request.security(syminfo.tickerid, "240", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 3, request.security(syminfo.tickerid, "240", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 3, request.security(syminfo.tickerid, "240", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 4, request.security(syminfo.tickerid, "240", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 4, request.security(syminfo.tickerid, "240", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 5, request.security(syminfo.tickerid, "240", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 5, request.security(syminfo.tickerid, "240", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 6, request.security(syminfo.tickerid, "240", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 6, request.security(syminfo.tickerid, "240", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 7, request.security(syminfo.tickerid, "240", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 7, request.security(syminfo.tickerid, "240", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 8, request.security(syminfo.tickerid, "240", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 8, request.security(syminfo.tickerid, "240", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 9, request.security(syminfo.tickerid, "240", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 9, request.security(syminfo.tickerid, "240", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 10, request.security(syminfo.tickerid, "240", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 10, request.security(syminfo.tickerid, "240", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 11, request.security(syminfo.tickerid, "240", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 11, request.security(syminfo.tickerid, "240", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 12, request.security(syminfo.tickerid, "240", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 12, request.security(syminfo.tickerid, "240", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 13, request.security(syminfo.tickerid, "240", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 13, request.security(syminfo.tickerid, "240", low[13], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 0, request.security(syminfo.tickerid, "D", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 0, request.security(syminfo.tickerid, "D", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 1, request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 1, request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 2, request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 2, request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 3, request.security(syminfo.tickerid, "D", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 3, request.security(syminfo.tickerid, "D", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 4, request.security(syminfo.tickerid, "D", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 4, request.security(syminfo.tickerid, "D", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 5, request.security(syminfo.tickerid, "D", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 5, request.security(syminfo.tickerid, "D", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 6, request.security(syminfo.tickerid, "D", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 6, request.security(syminfo.tickerid, "D", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 7, request.security(syminfo.tickerid, "D", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 7, request.security(syminfo.tickerid, "D", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 8, request.security(syminfo.tickerid, "D", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 8, request.security(syminfo.tickerid, "D", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 9, request.security(syminfo.tickerid, "D", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 9, request.security(syminfo.tickerid, "D", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 10, request.security(syminfo.tickerid, "D", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 10, request.security(syminfo.tickerid, "D", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 11, request.security(syminfo.tickerid, "D", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 11, request.security(syminfo.tickerid, "D", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 12, request.security(syminfo.tickerid, "D", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 12, request.security(syminfo.tickerid, "D", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 13, request.security(syminfo.tickerid, "D", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 13, request.security(syminfo.tickerid, "D", low[13], lookahead=barmerge.lookahead_on))
// Manual ATR calculation function (simplified for 14 periods)
manual_atr(high_series, low_series) =>
var float tr_sum = 0.0
for i = 0 to 13
high_prev = nz(array.get(high_series, i + 1), array.get(high_series, i))
low_prev = nz(array.get(low_series, i + 1), array.get(low_series, i))
tr = math.max(array.get(high_series, i), high_prev) - math.min(array.get(low_series, i), low_prev)
tr_sum := tr_sum + tr
tr_sum / 14 // Average True Range over 14 periods
// FVG Detection for Higher Timeframes (1H, 4H, D)
// 1H (60 minutes)
atr_1h = manual_atr(high_series_1h, low_series_1h)
low_1h = request.security(syminfo.tickerid, "60", low, lookahead=barmerge.lookahead_on)
high_1h = request.security(syminfo.tickerid, "60", high[2], lookahead=barmerge.lookahead_on)
close_1h = request.security(syminfo.tickerid, "60", close[1], lookahead=barmerge.lookahead_on)
open_1h = request.security(syminfo.tickerid, "60", open[1], lookahead=barmerge.lookahead_on)
low_1h_bear = request.security(syminfo.tickerid, "60", low[2], lookahead=barmerge.lookahead_on)
high_1h_bear = request.security(syminfo.tickerid, "60", high, lookahead=barmerge.lookahead_on)
fvg_bull_1h = low_1h > high_1h and close_1h > open_1h and (low_1h - high_1h) >= fvg_min_range * atr_1h and (low_1h - high_1h) > 0
fvg_bear_1h = high_1h_bear < low_1h_bear and close_1h < open_1h and (low_1h_bear - high_1h_bear) >= fvg_min_range * atr_1h and (low_1h_bear - high_1h_bear) > 0
new_fvg_bull_1h = fvg_bull_1h and not fvg_bull_1h[1]
new_fvg_bear_1h = fvg_bear_1h and not fvg_bear_1h[1]
if new_fvg_bull_1h and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_1h)
array.push(active_bottoms, high_1h)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_1h, right=bar_index+10, bottom=high_1h, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_1h and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_1h_bear)
array.push(active_bottoms, high_1h_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_1h_bear, right=bar_index+10, bottom=high_1h_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// 4H (240 minutes)
atr_4h = manual_atr(high_series_4h, low_series_4h)
low_4h = request.security(syminfo.tickerid, "240", low, lookahead=barmerge.lookahead_on)
high_4h = request.security(syminfo.tickerid, "240", high[2], lookahead=barmerge.lookahead_on)
close_4h = request.security(syminfo.tickerid, "240", close[1], lookahead=barmerge.lookahead_on)
open_4h = request.security(syminfo.tickerid, "240", open[1], lookahead=barmerge.lookahead_on)
low_4h_bear = request.security(syminfo.tickerid, "240", low[2], lookahead=barmerge.lookahead_on)
high_4h_bear = request.security(syminfo.tickerid, "240", high, lookahead=barmerge.lookahead_on)
fvg_bull_4h = low_4h > high_4h and close_4h > open_4h and (low_4h - high_4h) >= fvg_min_range * atr_4h and (low_4h - high_4h) > 0
fvg_bear_4h = high_4h_bear < low_4h_bear and close_4h < open_4h and (low_4h_bear - high_4h_bear) >= fvg_min_range * atr_4h and (low_4h_bear - high_4h_bear) > 0
new_fvg_bull_4h = fvg_bull_4h and not fvg_bull_4h[1]
new_fvg_bear_4h = fvg_bear_4h and not fvg_bear_4h[1]
if new_fvg_bull_4h and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_4h)
array.push(active_bottoms, high_4h)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_4h, right=bar_index+10, bottom=high_4h, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_4h and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_4h_bear)
array.push(active_bottoms, high_4h_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_4h_bear, right=bar_index+10, bottom=high_4h_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// Daily (D)
atr_d = manual_atr(high_series_d, low_series_d)
low_d = request.security(syminfo.tickerid, "D", low, lookahead=barmerge.lookahead_on)
high_d = request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on)
close_d = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
open_d = request.security(syminfo.tickerid, "D", open[1], lookahead=barmerge.lookahead_on)
low_d_bear = request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on)
high_d_bear = request.security(syminfo.tickerid, "D", high, lookahead=barmerge.lookahead_on)
fvg_bull_d = low_d > high_d and close_d > open_d and (low_d - high_d) >= fvg_min_range * atr_d and (low_d - high_d) > 0
fvg_bear_d = high_d_bear < low_d_bear and close_d < open_d and (low_d_bear - high_d_bear) >= fvg_min_range * atr_d and (low_d_bear - high_d_bear) > 0
new_fvg_bull_d = fvg_bull_d and not fvg_bull_d[1]
new_fvg_bear_d = fvg_bear_d and not fvg_bear_d[1]
if new_fvg_bull_d and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_d)
array.push(active_bottoms, high_d)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_d, right=bar_index+10, bottom=high_d, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_d and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_d_bear)
array.push(active_bottoms, high_d_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_d_bear, right=bar_index+10, bottom=high_d_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// FVG Detection for Current Timeframe (15M)
gap_bull_15m = low - high[2]
gap_bear_15m = low[2] - high
fvg_bull_15m = low > high[2] and close[1] > open[1] and gap_bull_15m >= fvg_min_range * atr and gap_bull_15m > 0 and barstate.isconfirmed
fvg_bear_15m = high < low[2] and close[1] < open[1] and gap_bear_15m >= fvg_min_range * atr and gap_bear_15m > 0 and barstate.isconfirmed
if fvg_bull_15m and in_time_window and (bias == "Bullish" or bias == "Neutral")
array.push(active_tops, low)
array.push(active_bottoms, high[2])
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low, right=bar_index+10, bottom=high[2], bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if fvg_bear_15m and in_time_window and (bias == "Bearish" or bias == "Neutral")
array.push(active_tops, low[2])
array.push(active_bottoms, high)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low[2], right=bar_index+10, bottom=high, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// OB Detection for Current Timeframe (15M)
htf_sweep_bull = request.security(syminfo.tickerid, "60", low < low[1] and close > high[1], lookahead=barmerge.lookahead_on)
htf_sweep_bear = request.security(syminfo.tickerid, "60", high > high[1] and close < low[1], lookahead=barmerge.lookahead_on)
is_bull_ob = low < low[1] and close > open and close > high[1] and htf_sweep_bull[1] and barstate.isconfirmed
is_bear_ob = high > high[1] and close < open and close < low[1] and htf_sweep_bear[1] and barstate.isconfirmed
if is_bull_ob and in_time_window and (bias == "Bullish" or bias == "Neutral")
array.push(active_tops, high)
array.push(active_bottoms, low)
array.push(active_types, "ob_bullish")
new_box = box.new(left=bar_index, top=high, right=bar_index+10, bottom=low, bgcolor=color.new(color.blue, 80))
array.push(active_boxes, new_box)
if is_bear_ob and in_time_window and (bias == "Bearish" or bias == "Neutral")
array.push(active_tops, high)
array.push(active_bottoms, low)
array.push(active_types, "ob_bearish")
new_box = box.new(left=bar_index, top=high, right=bar_index+10, bottom=low, bgcolor=color.new(color.orange, 80))
array.push(active_boxes, new_box)
// SMT Divergence Detection
nasdaq_l = request.security(nasdaq, "15", low, lookahead=barmerge.lookahead_on)
nasdaq_h = request.security(nasdaq, "15", high, lookahead=barmerge.lookahead_on)
dow_l = request.security(dow, "15", low, lookahead=barmerge.lookahead_on)
dow_h = request.security(dow, "15", high, lookahead=barmerge.lookahead_on)
sp500_l = request.security(sp500, "15", low, lookahead=barmerge.lookahead_on)
sp500_h = request.security(sp500, "15", high, lookahead=barmerge.lookahead_on)
bull_div_n = low < low[1] and nasdaq_l > nasdaq_l[1]
bull_div_d = low < low[1] and dow_l > dow_l[1]
bull_div_s = low < low[1] and sp500_l > sp500_l[1]
bear_div_n = high > high[1] and nasdaq_h < nasdaq_h[1]
bear_div_d = high > high[1] and dow_h < dow_h[1]
bear_div_s = high > high[1] and sp500_h < sp500_h[1]
div_count_bull = (bull_div_n ? 1 : 0) + (bull_div_d ? 1 : 0) + (bull_div_s ? 1 : 0)
div_count_bear = (bear_div_n ? 1 : 0) + (bear_div_d ? 1 : 0) + (bear_div_s ? 1 : 0)
smt_bull = div_count_bull >= 2 and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
smt_bear = div_count_bear >= 2 and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
plotshape(smt_bull, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(smt_bear, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Mitigation Logic for Active Zones
for i = array.size(active_tops) - 1 to 0
type = array.get(active_types, i)
top = array.get(active_tops, i)
bottom = array.get(active_bottoms, i)
if (type == "fvg_bullish" and close < bottom) or (type == "fvg_bearish" and close > top) or (type == "ob_bullish" and close < bottom) or (type == "ob_bearish" and close > top)
box.delete(array.get(active_boxes, i))
array.remove(active_tops, i)
array.remove(active_bottoms, i)
array.remove(active_types, i)
array.remove(active_boxes, i)
// Array Size Limit
if array.size(active_boxes) > 50
box.delete(array.get(active_boxes, 0))
array.remove(active_tops, 0)
array.remove(active_bottoms, 0)
array.remove(active_types, 0)
array.remove(active_boxes, 0)
// Alerts
alertcondition(fvg_bull_15m or fvg_bull_1h or fvg_bull_4h or fvg_bull_d, "Bullish FVG Detected", "Bullish FVG on {{ticker}}")
alertcondition(fvg_bear_15m or fvg_bear_1h or fvg_bear_4h or fvg_bear_d, "Bearish FVG Detected", "Bearish FVG on {{ticker}}")
alertcondition(is_bull_ob, "Bullish OB Detected", "Bullish OB on {{ticker}}")
alertcondition(is_bear_ob, "Bearish OB Detected", "Bearish OB on {{ticker}}")
alertcondition(smt_bull, "Bullish SMT Divergence", "Bullish SMT Divergence on {{ticker}}")
alertcondition(smt_bear, "Bearish SMT Divergence", "Bearish SMT Divergence on {{ticker}}")
indicator("Forever Model Replica", overlay=true, dynamic_requests=true)
// Inputs
nasdaq = input.string("NASDAQ:NDX", "Nasdaq Symbol")
dow = input.string("DJ:DJI", "Dow Jones Symbol")
sp500 = input.string("SP:SPX", "S&P 500 Symbol")
fvg_min_range = input.float(0.5, "Min FVG Range (% of ATR)", minval=0.1)
bias = input.string("Neutral", "Directional Bias", options=["Bullish", "Bearish", "Neutral"])
session_filter = input.bool(true, "Filter by US Session (9 AM–5 PM UTC)")
start_hour = input.int(9, "Start Hour (UTC)", minval=0, maxval=23)
end_hour = input.int(17, "End Hour (UTC)", minval=0, maxval=23)
// ATR and Time Filter
atr = ta.atr(14)
in_time_window = not session_filter or (hour >= start_hour and hour <= end_hour)
// Arrays for active zones (FVGs and OBs)
var active_tops = array.new_float(0)
var active_bottoms = array.new_float(0)
var active_types = array.new_string(0)
var active_boxes = array.new_box(0)
// Pre-fetch price data for 14 bars for each timeframe
var float[] high_series_1h = array.new_float(14)
var float[] low_series_1h = array.new_float(14)
var float[] high_series_4h = array.new_float(14)
var float[] low_series_4h = array.new_float(14)
var float[] high_series_d = array.new_float(14)
var float[] low_series_d = array.new_float(14)
array.set(high_series_1h, 0, request.security(syminfo.tickerid, "60", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 0, request.security(syminfo.tickerid, "60", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 1, request.security(syminfo.tickerid, "60", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 1, request.security(syminfo.tickerid, "60", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 2, request.security(syminfo.tickerid, "60", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 2, request.security(syminfo.tickerid, "60", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 3, request.security(syminfo.tickerid, "60", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 3, request.security(syminfo.tickerid, "60", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 4, request.security(syminfo.tickerid, "60", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 4, request.security(syminfo.tickerid, "60", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 5, request.security(syminfo.tickerid, "60", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 5, request.security(syminfo.tickerid, "60", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 6, request.security(syminfo.tickerid, "60", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 6, request.security(syminfo.tickerid, "60", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 7, request.security(syminfo.tickerid, "60", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 7, request.security(syminfo.tickerid, "60", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 8, request.security(syminfo.tickerid, "60", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 8, request.security(syminfo.tickerid, "60", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 9, request.security(syminfo.tickerid, "60", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 9, request.security(syminfo.tickerid, "60", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 10, request.security(syminfo.tickerid, "60", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 10, request.security(syminfo.tickerid, "60", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 11, request.security(syminfo.tickerid, "60", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 11, request.security(syminfo.tickerid, "60", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 12, request.security(syminfo.tickerid, "60", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 12, request.security(syminfo.tickerid, "60", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_1h, 13, request.security(syminfo.tickerid, "60", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_1h, 13, request.security(syminfo.tickerid, "60", low[13], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 0, request.security(syminfo.tickerid, "240", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 0, request.security(syminfo.tickerid, "240", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 1, request.security(syminfo.tickerid, "240", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 1, request.security(syminfo.tickerid, "240", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 2, request.security(syminfo.tickerid, "240", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 2, request.security(syminfo.tickerid, "240", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 3, request.security(syminfo.tickerid, "240", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 3, request.security(syminfo.tickerid, "240", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 4, request.security(syminfo.tickerid, "240", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 4, request.security(syminfo.tickerid, "240", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 5, request.security(syminfo.tickerid, "240", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 5, request.security(syminfo.tickerid, "240", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 6, request.security(syminfo.tickerid, "240", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 6, request.security(syminfo.tickerid, "240", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 7, request.security(syminfo.tickerid, "240", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 7, request.security(syminfo.tickerid, "240", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 8, request.security(syminfo.tickerid, "240", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 8, request.security(syminfo.tickerid, "240", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 9, request.security(syminfo.tickerid, "240", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 9, request.security(syminfo.tickerid, "240", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 10, request.security(syminfo.tickerid, "240", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 10, request.security(syminfo.tickerid, "240", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 11, request.security(syminfo.tickerid, "240", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 11, request.security(syminfo.tickerid, "240", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 12, request.security(syminfo.tickerid, "240", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 12, request.security(syminfo.tickerid, "240", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_4h, 13, request.security(syminfo.tickerid, "240", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_4h, 13, request.security(syminfo.tickerid, "240", low[13], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 0, request.security(syminfo.tickerid, "D", high[0], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 0, request.security(syminfo.tickerid, "D", low[0], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 1, request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 1, request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 2, request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 2, request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 3, request.security(syminfo.tickerid, "D", high[3], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 3, request.security(syminfo.tickerid, "D", low[3], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 4, request.security(syminfo.tickerid, "D", high[4], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 4, request.security(syminfo.tickerid, "D", low[4], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 5, request.security(syminfo.tickerid, "D", high[5], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 5, request.security(syminfo.tickerid, "D", low[5], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 6, request.security(syminfo.tickerid, "D", high[6], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 6, request.security(syminfo.tickerid, "D", low[6], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 7, request.security(syminfo.tickerid, "D", high[7], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 7, request.security(syminfo.tickerid, "D", low[7], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 8, request.security(syminfo.tickerid, "D", high[8], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 8, request.security(syminfo.tickerid, "D", low[8], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 9, request.security(syminfo.tickerid, "D", high[9], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 9, request.security(syminfo.tickerid, "D", low[9], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 10, request.security(syminfo.tickerid, "D", high[10], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 10, request.security(syminfo.tickerid, "D", low[10], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 11, request.security(syminfo.tickerid, "D", high[11], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 11, request.security(syminfo.tickerid, "D", low[11], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 12, request.security(syminfo.tickerid, "D", high[12], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 12, request.security(syminfo.tickerid, "D", low[12], lookahead=barmerge.lookahead_on))
array.set(high_series_d, 13, request.security(syminfo.tickerid, "D", high[13], lookahead=barmerge.lookahead_on))
array.set(low_series_d, 13, request.security(syminfo.tickerid, "D", low[13], lookahead=barmerge.lookahead_on))
// Manual ATR calculation function (simplified for 14 periods)
manual_atr(high_series, low_series) =>
var float tr_sum = 0.0
for i = 0 to 13
high_prev = nz(array.get(high_series, i + 1), array.get(high_series, i))
low_prev = nz(array.get(low_series, i + 1), array.get(low_series, i))
tr = math.max(array.get(high_series, i), high_prev) - math.min(array.get(low_series, i), low_prev)
tr_sum := tr_sum + tr
tr_sum / 14 // Average True Range over 14 periods
// FVG Detection for Higher Timeframes (1H, 4H, D)
// 1H (60 minutes)
atr_1h = manual_atr(high_series_1h, low_series_1h)
low_1h = request.security(syminfo.tickerid, "60", low, lookahead=barmerge.lookahead_on)
high_1h = request.security(syminfo.tickerid, "60", high[2], lookahead=barmerge.lookahead_on)
close_1h = request.security(syminfo.tickerid, "60", close[1], lookahead=barmerge.lookahead_on)
open_1h = request.security(syminfo.tickerid, "60", open[1], lookahead=barmerge.lookahead_on)
low_1h_bear = request.security(syminfo.tickerid, "60", low[2], lookahead=barmerge.lookahead_on)
high_1h_bear = request.security(syminfo.tickerid, "60", high, lookahead=barmerge.lookahead_on)
fvg_bull_1h = low_1h > high_1h and close_1h > open_1h and (low_1h - high_1h) >= fvg_min_range * atr_1h and (low_1h - high_1h) > 0
fvg_bear_1h = high_1h_bear < low_1h_bear and close_1h < open_1h and (low_1h_bear - high_1h_bear) >= fvg_min_range * atr_1h and (low_1h_bear - high_1h_bear) > 0
new_fvg_bull_1h = fvg_bull_1h and not fvg_bull_1h[1]
new_fvg_bear_1h = fvg_bear_1h and not fvg_bear_1h[1]
if new_fvg_bull_1h and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_1h)
array.push(active_bottoms, high_1h)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_1h, right=bar_index+10, bottom=high_1h, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_1h and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_1h_bear)
array.push(active_bottoms, high_1h_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_1h_bear, right=bar_index+10, bottom=high_1h_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// 4H (240 minutes)
atr_4h = manual_atr(high_series_4h, low_series_4h)
low_4h = request.security(syminfo.tickerid, "240", low, lookahead=barmerge.lookahead_on)
high_4h = request.security(syminfo.tickerid, "240", high[2], lookahead=barmerge.lookahead_on)
close_4h = request.security(syminfo.tickerid, "240", close[1], lookahead=barmerge.lookahead_on)
open_4h = request.security(syminfo.tickerid, "240", open[1], lookahead=barmerge.lookahead_on)
low_4h_bear = request.security(syminfo.tickerid, "240", low[2], lookahead=barmerge.lookahead_on)
high_4h_bear = request.security(syminfo.tickerid, "240", high, lookahead=barmerge.lookahead_on)
fvg_bull_4h = low_4h > high_4h and close_4h > open_4h and (low_4h - high_4h) >= fvg_min_range * atr_4h and (low_4h - high_4h) > 0
fvg_bear_4h = high_4h_bear < low_4h_bear and close_4h < open_4h and (low_4h_bear - high_4h_bear) >= fvg_min_range * atr_4h and (low_4h_bear - high_4h_bear) > 0
new_fvg_bull_4h = fvg_bull_4h and not fvg_bull_4h[1]
new_fvg_bear_4h = fvg_bear_4h and not fvg_bear_4h[1]
if new_fvg_bull_4h and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_4h)
array.push(active_bottoms, high_4h)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_4h, right=bar_index+10, bottom=high_4h, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_4h and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_4h_bear)
array.push(active_bottoms, high_4h_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_4h_bear, right=bar_index+10, bottom=high_4h_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// Daily (D)
atr_d = manual_atr(high_series_d, low_series_d)
low_d = request.security(syminfo.tickerid, "D", low, lookahead=barmerge.lookahead_on)
high_d = request.security(syminfo.tickerid, "D", high[2], lookahead=barmerge.lookahead_on)
close_d = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
open_d = request.security(syminfo.tickerid, "D", open[1], lookahead=barmerge.lookahead_on)
low_d_bear = request.security(syminfo.tickerid, "D", low[2], lookahead=barmerge.lookahead_on)
high_d_bear = request.security(syminfo.tickerid, "D", high, lookahead=barmerge.lookahead_on)
fvg_bull_d = low_d > high_d and close_d > open_d and (low_d - high_d) >= fvg_min_range * atr_d and (low_d - high_d) > 0
fvg_bear_d = high_d_bear < low_d_bear and close_d < open_d and (low_d_bear - high_d_bear) >= fvg_min_range * atr_d and (low_d_bear - high_d_bear) > 0
new_fvg_bull_d = fvg_bull_d and not fvg_bull_d[1]
new_fvg_bear_d = fvg_bear_d and not fvg_bear_d[1]
if new_fvg_bull_d and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_d)
array.push(active_bottoms, high_d)
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low_d, right=bar_index+10, bottom=high_d, bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if new_fvg_bear_d and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
array.push(active_tops, low_d_bear)
array.push(active_bottoms, high_d_bear)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low_d_bear, right=bar_index+10, bottom=high_d_bear, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// FVG Detection for Current Timeframe (15M)
gap_bull_15m = low - high[2]
gap_bear_15m = low[2] - high
fvg_bull_15m = low > high[2] and close[1] > open[1] and gap_bull_15m >= fvg_min_range * atr and gap_bull_15m > 0 and barstate.isconfirmed
fvg_bear_15m = high < low[2] and close[1] < open[1] and gap_bear_15m >= fvg_min_range * atr and gap_bear_15m > 0 and barstate.isconfirmed
if fvg_bull_15m and in_time_window and (bias == "Bullish" or bias == "Neutral")
array.push(active_tops, low)
array.push(active_bottoms, high[2])
array.push(active_types, "fvg_bullish")
new_box = box.new(left=bar_index, top=low, right=bar_index+10, bottom=high[2], bgcolor=color.new(color.green, 80))
array.push(active_boxes, new_box)
if fvg_bear_15m and in_time_window and (bias == "Bearish" or bias == "Neutral")
array.push(active_tops, low[2])
array.push(active_bottoms, high)
array.push(active_types, "fvg_bearish")
new_box = box.new(left=bar_index, top=low[2], right=bar_index+10, bottom=high, bgcolor=color.new(color.red, 80))
array.push(active_boxes, new_box)
// OB Detection for Current Timeframe (15M)
htf_sweep_bull = request.security(syminfo.tickerid, "60", low < low[1] and close > high[1], lookahead=barmerge.lookahead_on)
htf_sweep_bear = request.security(syminfo.tickerid, "60", high > high[1] and close < low[1], lookahead=barmerge.lookahead_on)
is_bull_ob = low < low[1] and close > open and close > high[1] and htf_sweep_bull[1] and barstate.isconfirmed
is_bear_ob = high > high[1] and close < open and close < low[1] and htf_sweep_bear[1] and barstate.isconfirmed
if is_bull_ob and in_time_window and (bias == "Bullish" or bias == "Neutral")
array.push(active_tops, high)
array.push(active_bottoms, low)
array.push(active_types, "ob_bullish")
new_box = box.new(left=bar_index, top=high, right=bar_index+10, bottom=low, bgcolor=color.new(color.blue, 80))
array.push(active_boxes, new_box)
if is_bear_ob and in_time_window and (bias == "Bearish" or bias == "Neutral")
array.push(active_tops, high)
array.push(active_bottoms, low)
array.push(active_types, "ob_bearish")
new_box = box.new(left=bar_index, top=high, right=bar_index+10, bottom=low, bgcolor=color.new(color.orange, 80))
array.push(active_boxes, new_box)
// SMT Divergence Detection
nasdaq_l = request.security(nasdaq, "15", low, lookahead=barmerge.lookahead_on)
nasdaq_h = request.security(nasdaq, "15", high, lookahead=barmerge.lookahead_on)
dow_l = request.security(dow, "15", low, lookahead=barmerge.lookahead_on)
dow_h = request.security(dow, "15", high, lookahead=barmerge.lookahead_on)
sp500_l = request.security(sp500, "15", low, lookahead=barmerge.lookahead_on)
sp500_h = request.security(sp500, "15", high, lookahead=barmerge.lookahead_on)
bull_div_n = low < low[1] and nasdaq_l > nasdaq_l[1]
bull_div_d = low < low[1] and dow_l > dow_l[1]
bull_div_s = low < low[1] and sp500_l > sp500_l[1]
bear_div_n = high > high[1] and nasdaq_h < nasdaq_h[1]
bear_div_d = high > high[1] and dow_h < dow_h[1]
bear_div_s = high > high[1] and sp500_h < sp500_h[1]
div_count_bull = (bull_div_n ? 1 : 0) + (bull_div_d ? 1 : 0) + (bull_div_s ? 1 : 0)
div_count_bear = (bear_div_n ? 1 : 0) + (bear_div_d ? 1 : 0) + (bear_div_s ? 1 : 0)
smt_bull = div_count_bull >= 2 and in_time_window and (bias == "Bullish" or bias == "Neutral") and barstate.isconfirmed
smt_bear = div_count_bear >= 2 and in_time_window and (bias == "Bearish" or bias == "Neutral") and barstate.isconfirmed
plotshape(smt_bull, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(smt_bear, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Mitigation Logic for Active Zones
for i = array.size(active_tops) - 1 to 0
type = array.get(active_types, i)
top = array.get(active_tops, i)
bottom = array.get(active_bottoms, i)
if (type == "fvg_bullish" and close < bottom) or (type == "fvg_bearish" and close > top) or (type == "ob_bullish" and close < bottom) or (type == "ob_bearish" and close > top)
box.delete(array.get(active_boxes, i))
array.remove(active_tops, i)
array.remove(active_bottoms, i)
array.remove(active_types, i)
array.remove(active_boxes, i)
// Array Size Limit
if array.size(active_boxes) > 50
box.delete(array.get(active_boxes, 0))
array.remove(active_tops, 0)
array.remove(active_bottoms, 0)
array.remove(active_types, 0)
array.remove(active_boxes, 0)
// Alerts
alertcondition(fvg_bull_15m or fvg_bull_1h or fvg_bull_4h or fvg_bull_d, "Bullish FVG Detected", "Bullish FVG on {{ticker}}")
alertcondition(fvg_bear_15m or fvg_bear_1h or fvg_bear_4h or fvg_bear_d, "Bearish FVG Detected", "Bearish FVG on {{ticker}}")
alertcondition(is_bull_ob, "Bullish OB Detected", "Bullish OB on {{ticker}}")
alertcondition(is_bear_ob, "Bearish OB Detected", "Bearish OB on {{ticker}}")
alertcondition(smt_bull, "Bullish SMT Divergence", "Bullish SMT Divergence on {{ticker}}")
alertcondition(smt_bear, "Bearish SMT Divergence", "Bearish SMT Divergence on {{ticker}}")
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.