Question about this code

 

I'm currently writing code for a new EA.

I wanted to write a code to place a buy order only if RSI crossed down below 50 level, and then cross back up over the 50 level. After RSI crossed back up above 50 level then place a buy order

Is this the right line to use?

if((iRSI(NULL,0,10,PRICE_MEDIAN,0)<50)&&(iRSI(NULL,0,10,PRICE_MEDIAN,0)>50))

 
if ((iRSI(NULL, NULL,10,PRICE_MEDIAN,1) < 50) && (iRSI(NULL, NULL,10,PRICE_MEDIAN,0) > 50))  //Previous Candle Closed below <50 level and Current Candle Cross up >50 Level.