OPEN-SOURCE SCRIPT

Liquidity + CHoCH Strategy - 1:3 RRR

222
//version=5
strategy("Liquidity + CHoCH Strategy - 1:3 RRR", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// ==== PARAMETERS ====
rrr = 3.0 // Risk-to-Reward Ratio
engulfing_size = input.float(0.1, "Min Body Size %", minval=0.01)

// ==== ENGULFING CANDLE DETECTION ====
isBullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open <= close[1]
isBearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open >= close[1]

// ==== CHoCH LOGIC (Simple BOS flip) ====
hh = ta.highest(high, 5)
ll = ta.lowest(low, 5)

chochUp = close > hh[1]
chochDown = close < ll[1]

// ==== ENTRY LOGIC ====
longCondition = chochUp and isBullishEngulfing
shortCondition = chochDown and isBearishEngulfing

// ==== ENTRY EXECUTION ====
if (longCondition)
sl = low - syminfo.mintick * 10
tp = close + (close - sl) * rrr
strategy.entry("Long", strategy.long)
strategy.exit("TP/SL Long", "Long", stop=sl, limit=tp)

if (shortCondition)
sl = high + syminfo.mintick * 10
tp = close - (sl - close) * rrr
strategy.entry("Short", strategy.short)
strategy.exit("TP/SL Short", "Short", stop=sl, limit=tp)

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.