sonu1997
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sonu1997

//@version=4
//@version=5
strategy('moving average strategy', overlay=true)

ema50 =ema(close, 50)
ema200 =ema(close, 200)



long = ema50 > ema200
short = ema50 < ema200

strategy.entry('long', strategy.long, 100, 0, when=long)
strategy.entry('short', strategy.short, 100, 0, when=short)

strategy.close('long', when=short)
strategy.close('short', when=long)
