Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

//@version=5

strategy("sma strategy buy", overlay=true)


len = input.int(12, minval=1, title="Length")
src = input(close, title="Source")
price = close
length = input(title="MA", defval=19)

var color green = color.new(color.green,50)

good = ta.sma(close, 20) > ta.sma(close, 50) and ta.sma(close, 50) > ta.sma(close,
200)
candle = close [2] > ta.sma (close, 20) and close [1] < ta.sma(close, 20) and
close [0] > ta.sma(close, 20)
candells = close [3] > ta.sma (close, 20) and close [2] < ta.sma(close, 20) and
close [1] < ta.sma(close, 20) and close [0] > ta.sma(close, 20)
candellls = close [4] > ta.sma (close, 20) and close [3] < ta.sma(close, 20) and
close [2] < ta.sma(close, 20) and close [1] < ta.sma(close, 20) and close [0] >
ta.sma(close, 20)

enter =good and ( candle or candells or candellls )

if (enter)
strategy.entry("MomLE", strategy.long, stop=high+syminfo.mintick,
comment="MomLE")

if (close < ta.sma (close, 20) or close < ta.sma (close, 50))
strategy.exit("MomLE", "MomLE", profit = close ,loss = close * 0.012 /
syminfo.mintick, comment="exit")

//plot(strategy.equity, title="equity", color=color.red, linewidth=2,


style=plot.style_areabr)

You might also like