0% found this document useful (0 votes)
9 views1 page

Pane

Uploaded by

eagle.kamal08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Pane

Uploaded by

eagle.kamal08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//@version=5

indicator("Simple MA Crossover Strategy", overlay=true)

// Input settings
short_length = input.int(9, title="Short Moving Average Period", minval=1)
long_length = input.int(21, title="Long Moving Average Period", minval=1)

// Calculate Moving Averages


short_ma = ta.sma(close, short_length)
long_ma = ta.sma(close, long_length)

// Define Buy and Sell conditions


buy_condition = ta.crossover(short_ma, long_ma)
sell_condition = ta.crossunder(short_ma, long_ma)

// Plot the moving averages on the chart


plot(short_ma, color=color.blue, title="Short MA")
plot(long_ma, color=color.red, title="Long MA")

// Plot Buy and Sell signals as arrows


plotshape(series=buy_condition, location=location.belowbar, color=color.green,
style=shape.labelup, title="Buy Signal", text="BUY")
plotshape(series=sell_condition, location=location.abovebar, color=color.red,
style=shape.labeldown, title="Sell Signal", text="SELL")

// Alert conditions for TradingView alerts


alertcondition(buy_condition, title="Buy Alert", message="Buy signal triggered")
alertcondition(sell_condition, title="Sell Alert", message="Sell signal triggered")

You might also like