PRO SMC - Institutional Signal System

FX_Petersetups_00 · study · 97 行 · 点赞 13 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FX_Petersetups_00
 
 
 //@version=6
indicator("PRO SMC - Institutional Signal System", overlay=true, max_labels_count=500, max_lines_count=500)
 
// SETTINGS
pivotLen = input.int(5, "Swing Length", minval=2)
emaFastLen = input.int(50, "Fast EMA")
emaSlowLen = input.int(200, "Slow EMA")
rsiLen = input.int(14, "RSI Length")
atrLen = input.int(14, "ATR Length")
atrMult = input.float(1.5, "Stop Loss ATR Multiplier")
riskReward = input.float(2.0, "Risk Reward Ratio")
 
// INDICATORS
ema50 = ta.ema(close, emaFastLen)
ema200 = ta.ema(close, emaSlowLen)
rsi = ta.rsi(close, rsiLen)
atr = ta.atr(atrLen)
 
// MARKET STRUCTURE
ph = ta.pivothigh(high, pivotLen, pivotLen)
pl = ta.pivotlow(low, pivotLen, pivotLen)
 
var float swingHigh = na
var float swingLow = na
var int highBar = na
var int lowBar = na
var int trend = 0
 
if not na(ph)
    swingHigh := ph
    highBar := bar_index - pivotLen
 
if not na(pl)
    swingLow := pl
    lowBar := bar_index - pivotLen
 
bullBreak = not na(swingHigh) and ta.crossover(close, swingHigh)
bearBreak = not na(swingLow) and ta.crossunder(close, swingLow)
 
bullChoch = bullBreak and trend == -1
bearChoch = bearBreak and trend == 1
 
bullBos = bullBreak and not bullChoch
bearBos = bearBreak and not bearChoch
 
if bullBreak
    line.new(highBar, swingHigh, bar_index, swingHigh, color=color.lime)
    label.new(bar_index, high, bullChoch ? "CHoCH ↑" : "BOS ↑", style=label.style_label_down, color=color.green, textcolor=color.white)
    trend := 1
 
if bearBreak
    line.new(lowBar, swingLow, bar_index, swingLow, color=color.red)
    label.new(bar_index, low, bearChoch ? "CHoCH ↓" : "BOS ↓", style=label.style_label_up, color=color.red, textcolor=color.white)
    trend := -1
 
// TREND AND MOMENTUM FILTERS
bullTrend = ema50 > ema200 and close > ema50
bearTrend = ema50 < ema200 and close < ema50
 
bullMomentum = rsi > 50
bearMomentum = rsi < 50
 
// CONFIRMED BUY / SELL
buySignal = bullBreak and bullTrend and bullMomentum and barstate.isconfirmed
sellSignal = bearBreak and bearTrend and bearMomentum and barstate.isconfirmed
 
// ATR RISK LEVELS
var float activeStop = na
var float activeTarget = na
 
if buySignal
    activeStop := close - atr * atrMult
    activeTarget := close + (close - activeStop) * riskReward
 
if sellSignal
    activeStop := close + atr * atrMult
    activeTarget := close - (activeStop - close) * riskReward
 
// DISPLAY
plot(ema50, "EMA 50", color=color.orange, linewidth=2)
plot(ema200, "EMA 200", color=color.blue, linewidth=2)
 
plot(activeStop, "Active Stop Loss", color=color.red, style=plot.style_linebr, linewidth=2)
plot(activeTarget, "Active Take Profit", color=color.lime, style=plot.style_linebr, linewidth=2)
 
plotshape(buySignal, title="BUY", style=shape.labelup, location=location.belowbar, color=color.lime, text="BUY", textcolor=color.black)
plotshape(sellSignal, title="SELL", style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", textcolor=color.white)
 
// ALERTS
alertcondition(buySignal, "SMC BUY", "SMC confirmed BUY signal")
alertcondition(sellSignal, "SMC SELL", "SMC confirmed SELL signal")
alertcondition(bullChoch, "Bullish CHoCH", "Bullish Change of Character")
alertcondition(bearChoch, "Bearish CHoCH", "Bearish Change of Character")

← 返回列表