Vishi EMA Strategy

Hi there,

Please code my below strategy:

Buy Signal

if both open and close of candle is above 20 EMA

Sell Signal

if both open and close of candle is below 20 EMA

​Thanks

1 Like

Buy: OPEN>EMA(CLOSE,20) AND CLOSE>EMA(CLOSE,20)

Sell: OPEN<EMA(CLOSE,20) AND CLOSE<EMA(CLOSE,20)

 It only shows indications according to OHLC pattern and we can't make only first signal to show

Buy 

CLOSE > EMA(CLOSE, 20) AND OPEN > EMA(CLOSE, 20)

Sell

CLOSE < EMA(CLOSE, 20) AND OPEN < EMA(CLOSE, 20)

Thanks for the answer Senthil. However, we should only get 1 buy call on the first bar it opens and closes above 20 EMA. and the first exit or sell call when it opens and close below 20 EMA. Can you please tweak it?

I don’t think this is possible, since we don’t have a parameter in tradescript which can control the number of signals it gives.

is it possible to get a line which connects all the closes of the candles? then it would be simply a crossover of 20EMA and this new line. plz let me know if that works. Thanks.