//version=5
strategy("Aatmanirbhar Indicator with Buy/Sell Orders and Alerts", overlay=true)
// Input parameters
fast_length = input.int(9, "Fast MA Length")
slow_length = input.int(21, "Slow MA Length")
// Calculate moving averages
fast_ma = ta.sma(close, fast_length)
slow_ma = ta.sma(close, slow_length)
// Determine buy and sell signals
buy_signal = ta.crossover(fast_ma, slow_ma)
sell_signal = ta.crossunder(fast_ma, slow_ma)
// Place buy and sell orders
strategy.entry("Buy", strategy.long, when=buy_signal)
strategy.entry("Sell", strategy.short, when=sell_signal)
// Plot buy and sell signals on the chart
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// Send alerts for buy and sell signals
alertcondition(condition=buy_signal, title="Buy Signal", message="Buy Signal Detected")
alertcondition(condition=sell_signal, title="Sell Signal", message="Sell Signal Detected")
strategy("Aatmanirbhar Indicator with Buy/Sell Orders and Alerts", overlay=true)
// Input parameters
fast_length = input.int(9, "Fast MA Length")
slow_length = input.int(21, "Slow MA Length")
// Calculate moving averages
fast_ma = ta.sma(close, fast_length)
slow_ma = ta.sma(close, slow_length)
// Determine buy and sell signals
buy_signal = ta.crossover(fast_ma, slow_ma)
sell_signal = ta.crossunder(fast_ma, slow_ma)
// Place buy and sell orders
strategy.entry("Buy", strategy.long, when=buy_signal)
strategy.entry("Sell", strategy.short, when=sell_signal)
// Plot buy and sell signals on the chart
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// Send alerts for buy and sell signals
alertcondition(condition=buy_signal, title="Buy Signal", message="Buy Signal Detected")
alertcondition(condition=sell_signal, title="Sell Signal", message="Sell Signal Detected")
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.