Ok

//version=5
indicator("Simple SMA Crossover", overlay=true)

// Define the lengths for the short and long simple moving averages
shortLength = input(9, title="Short SMA Length")
longLength = input(21, title="Long SMA Length")

// Calculate the SMAs
shortSMA = ta.sma(close, shortLength)
longSMA = ta.sma(close, longLength)

// Plot the SMAs on the chart
plot(shortSMA, title="Short SMA", color=color.red)
plot(longSMA, title="Long SMA", color=color.blue)

// Generate buy and sell signals
buySignal = ta.crossover(shortSMA, longSMA)
sellSignal = ta.crossunder(shortSMA, longSMA)

// Plot buy and sell signals
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
Trend Analysis

Отказ от ответственности