1.618 Strategy Full System

strategy("1.618 Strategy Full System", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === SETTINGS ===
fibo_ratio = 1.618
atr_len = 14
risk_reward = 2.0
// === TREND DETECTION ===
ema_fast = ta.ema(close, 21)
ema_slow = ta.ema(close, 55)
trend_up = ema_fast > ema_slow
trend_down = ema_fast < ema_slow
// === MARKET STRUCTURE: SWING HIGH/LOW ===
swing_high = ta.pivothigh(high, 5, 5)
swing_low = ta.pivotlow(low, 5, 5)
// === FVG / Yetim svecha ===
fvg_up = low[2] > high
fvg_dn = high[2] < low
// === ORDER BLOCK (OB) ===
ob_bullish = close[1] < open[1] and close > open
ob_bearish = close[1] > open[1] and close < open
// === CANDLESTICK PATTERN: Engulfing ===
bullish_engulfing = close > open and open < close[1] and close[1] < open[1]
bearish_engulfing = close < open and open > close[1] and close[1] > open[1]
// === FIBONACCI 1.618 TARGET ===
entry_long = ta.valuewhen(trend_up and bullish_engulfing and ob_bullish and fvg_up, close, 0)
entry_short = ta.valuewhen(trend_down and bearish_engulfing and ob_bearish and fvg_dn, close, 0)
tp_long = entry_long + (math.abs(entry_long - swing_low)) * fibo_ratio
sl_long = swing_low
tp_short = entry_short - (math.abs(swing_high - entry_short)) * fibo_ratio
sl_short = swing_high
// === EXECUTE STRATEGY ===
if trend_up and bullish_engulfing and ob_bullish and fvg_up
strategy.entry("Long", strategy.long, comment="Long Entry")
strategy.exit("TP/SL Long", from_entry="Long", limit=tp_long, stop=sl_long)
if trend_down and bearish_engulfing and ob_bearish and fvg_dn
strategy.entry("Short", strategy.short, comment="Short Entry")
strategy.exit("TP/SL Short", from_entry="Short", limit=tp_short, stop=sl_short)
// === PLOTTING ===
plotshape(bullish_engulfing and trend_up, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(bearish_engulfing and trend_down, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.