OPEN-SOURCE SCRIPT

Scalping Indicator

//version=5
indicator("Scalping Indicator", overlay=true)

// Input parameters
fastEMA = input(9, title="Fast EMA Length")
slowEMA = input(21, title="Slow EMA Length")
signalSMA = input(9, title="Signal SMA Length")
rsiLength = input(14, title="RSI Length")
rsiOverbought = input(70, title="RSI Overbought Level")
rsiOversold = input(30, title="RSI Oversold Level")

// EMA calculations
fastEma = ta.ema(close, fastEMA)
slowEma = ta.ema(close, slowEMA)

// MACD calculations
[macdLine, signalLine, _] = ta.macd(close, fastEMA, slowEMA, signalSMA)

// RSI calculation
rsi = ta.rsi(close, rsiLength)

// Entry and exit conditions
longCondition = ta.crossover(fastEma, slowEma) and macdLine > signalLine and rsi < rsiOverbought
shortCondition = ta.crossunder(fastEma, slowEma) and macdLine < signalLine and rsi > rsiOversold

// Plot buy/sell signals
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Plot EMA lines
plot(fastEma, title="Fast EMA", color=color.blue)
plot(slowEma, title="Slow EMA", color=color.orange)

// Background highlights
bgcolor(longCondition ? color.new(color.green, 90) : na, title="Long Background")
bgcolor(shortCondition ? color.new(color.red, 90) : na, title="Short Background")
Chart patternsTrend AnalysisVolatility

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明