Close above or below EMA

Buy: ref(Close,1)>EMA(close,15)

Sell: ref(Close,1)<EMA(close,15).

After applying its not working as expected which is if bar closes above or below 15 EMA, then only i repeat then only the alert should be given. but its giving signals continously during bar formation.

I think there must be some minor issue, plz someone can correct it.

1 Like

you can use as below


Buy Expression:

SET MA1 = RSI(Close,14) < 30
SET MA2 = CROSSOVER(EMA(CLOSE, 21), CLOSE)
CROSSOVER(MA1, MA2) = TRUE

 Sell Expression: 

SET MA1 = RSI(Close,14) > 70
SET MA2 = CROSSOVER(EMA(CLOSE, 21), CLOSE)
CROSSOVER(MA1, MA2) = TRUE​

as per your condition withour rsi

Buy: 

REF(Close,1)>EMA(close,15)


Sell: 

REF(Close,1)<EMA(close,15)

and as we are using above and below ema only it obviously generate continues signals according to the condition ..you need to make changes in your conditon. if you want me to write with crossover i can.

by using crossover the code is below

CROSSOVER(CLOSE, EMA(CLOSE,15)) AND CLOSE>EMA(CLOSE,15)
1 Like

sorry sir, i dont want RSI to be included. plain close above or below EMA

can u plz tell me the code for close above or below 15 EMA, purely on closing basis.

you can use by making changes in conditions like you can use crossover to different ema

sorry sir…no knowledge of coding at all…want just a signal when price closes above or below a EMA.

sir withou RSI its the same as i have written in my message. its not waiting for the bar to close.

check about updated answer