indicator("Double Moving Average Trading Strategy", overlay=true) fastLength = input.int(10, title="Fast MA Period") slowLength = input.int(20, title="Slow MA Period") fastMA = ta.sma(close, fastLength) slowMA = ta.sma(close, slowLength) plot(fastMA, title="Fast MA", color=color.blue) plot(slowMA, title="Slow MA", color=color.red) if (ta.crossover(fastMA, slowMA)) label.new(bar_index, high, text="Buy", color=color.green) alert("Buy at: " + str.tostring(close), alert.freq_once_per_bar_close) if (ta.crossunder(fastMA, slowMA)) label.new(bar_index, low, text="Sell", color=color.red) alert("Sell at: " + str.tostring(close), alert.freq_once_per_bar_close)
Copyright © HW & YZ LLP
Powered by Vector Lab.