-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathNaitik
More file actions
45 lines (37 loc) · 1.85 KB
/
Naitik
File metadata and controls
45 lines (37 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//@version=5
indicator("SMC Liquidity + BOS Strategy", overlay=true, timeframe="5", timeframe_gaps=true)
// ─── Input Parameters ───
trend_tf = input.timeframe("60", "Trend Timeframe (1H)")
liquidity_tf = input.timeframe("30", "Liquidity Timeframe (30m)")
RR = input.float(2.0, "Risk-Reward (TP = RR × SL)")
lookback = input.int(12, "Lookback bars for BOS", minval=3)
show_labels = input.bool(true, "Show Entry/Exit Labels")
// ─── Higher timeframe data ───
[high1h, low1h, close1h] = request.security(syminfo.tickerid, trend_tf, [high, low, close])
[high30, low30] = request.security(syminfo.tickerid, liquidity_tf, [high, low])
// ─── Detect simple trend (HH/HL) ───
var float prev_high1h = na
var float prev_low1h = na
var int trend = 0 // 1 = uptrend, -1 = downtrend, 0 = neutral
if barstate.isnew
if not na(prev_high1h)
if high1h > prev_high1h and low1h > prev_low1h
trend := 1
else if high1h < prev_high1h and low1h < prev_low1h
trend := -1
else
trend := 0
prev_high1h := high1h
prev_low1h := low1h
// ─── Liquidity sweep check ───
liq_sweep_high = high > high30[1] and close < high
liq_sweep_low = low < low30[1] and close > low
// ─── Break of Structure (BOS) on current timeframe ───
bos_short = close < ta.lowest(low, lookback)[1]
bos_long = close > ta.highest(high, lookback)[1]
// ─── Entry Conditions ───
short_entry = (trend <= 0) and liq_sweep_high and bos_short
long_entry = (trend >= 0) and liq_sweep_low and bos_long
// ─── Plot Buy/Sell Arrows ───
plotshape(short_entry, title="Sell Signal", style=shape.triangledown, color=color.red, size=size.large, location=location.abovebar, text="SELL")
plotshape(long_entry, title="Buy Signal", style=shape.triangleup, color=color.lime, size=size.large, location