Code: Select all
sma50 = ta.sma(close, 50)
sma150 = ta.sma(close, 150)
plot(sma50, color=color.new(#000000, 0), linewidth=4, title='SMA 50')
plot(sma150, color=color.new(#76EE00 , 0), linewidth=4, title='SMA 150')
ANOTHER BUY CONDITION = ??? //in this stock, the last 40 days wasn't made a trade. The "40" shouldn't be a fix number, it also could be 60 or any other number, so it should be easy replaceable
if close < sma50 and close > sma150 and ANOTHER BUY CONDITION
strategy.entry('long', strategy.long)