Help for code with buy sell signal for price crossover EMA

when a price candle of a script crosses EMA 5, while EMA 5 > EMA 23 > EMA 100 ----- BUY

when a price candle of a script crosses EMA 5, while EMA 5 < EMA 23 < EMA 100 ------ SELL

plz provide the code asap.

thanks.

hElLO tRaDeR,

Assuming you have requested the code to use on Pi.

ASAP BUY CODE:

EMA(CLOSE,23) > EMA(CLOSE,100) AND 
EMA(CLOSE,5) > EMA(CLOSE,23) AND 
REF(CLOSE,1) < REF(EMA(CLOSE,5),1) AND 
CLOSE > EMA(CLOSE,5) 

ASAP SELL CODE:

EMA(CLOSE,23) < EMA(CLOSE,100) AND 
EMA(CLOSE,5) < EMA(CLOSE,23) AND 
REF(CLOSE,1) >REF(EMA(CLOSE,5),1) AND 
CLOSE < EMA(CLOSE,5) 

thanks for helping… jus wanna knw wht the below code does… jus for info…
REF(CLOSE,1) < REF(EMA(CLOSE,5),1)

It reads as "close of the second last candle was below 5EMA."
The continuation line reads as the "close on the last candle is now above 5EMA"
The combination of 2 lines identifies the Price crossing above 5EMA in the last candle

tried it on banknifty, it worked … jus a modification needed that it created alert very late, i want it when the price crosses EMA 5, while EMA 5 > EMA 23 > EMA 100 and vice versa.
plz add buy exit when price crosses below EMA 23
sell exit when price above EMA 23
how to add buy sell symbol in chart for alerts.
thanks for helping.

LONG EXIT :
CLOSE < EMA(CLOSE,23)
SELL EXIT:
CLOSE > EMA(CLOSE,23)

sorry buddy… but it is not generating alert all the time where as price is way above EMA5, and all condition of EMA are fulfilled and vice versa. … dont knw y. testing it on live banknifty chart of 1 min.
til now it has generated only one buy alert…

The code will generate alert only when there is a price cross over above 5EMA.
To generate alert without a crossover delete the 3rd line of the BUY and SELL code.

can i add buy sell symbol in chart… so that whn any alert is generated it will show in graph as well.

You have to use the code in EXPERT ADVISOR for use in charts:
Pi Toolbar >> Artificial Intelligence >> Create new Expert Advisor
After the EA is created, apply it on the charts for signal