Skip to content

Commit 229703d

Browse files
Create Naitik
1 parent 7677461 commit 229703d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

β€ŽNaitikβ€Ž

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

0 commit comments

Comments
Β (0)