OPEN-SOURCE SCRIPT

dual moving average crossover Erdal

27
//version=5
indicator("MA Cross Simple", overlay=true)

// Inputs
fastLen = input.int(10)
slowLen = input.int(100)

// Moving averages
fastMA = ta.sma(close, fastLen)
slowMA = ta.sma(close, slowLen)

// Plot
plot(fastMA, color=color.green)
plot(slowMA, color=color.red)

// Cross signals
bull = ta.crossover(fastMA, slowMA)
bear = ta.crossunder(fastMA, slowMA)

// Labels
if bull
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.green)

if bear
label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.red)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.