Written a code based on EMA & RSI , the logic is
if RSI > 50 and EMA(close,13) > EMA(close,21) we are in bullish mode
if RSI < 50 and EMA(close,13) < EMA(close,21) we are in bearish mode
now if you turn from bullish to bearish mode we “SELL” and
if you turn from bearish to bullish mode we “BUY” .
FOR BUY :
SET A=EMA(CLOSE,13)
SET B=EMA(CLOSE,21)
SET C=RSI(CLOSE,9)
SET D=A-B
SET A1=REF(EMA(CLOSE,13),1)
SET B1=REF(EMA(CLOSE,21),1)
SET C1=REF(RSI(CLOSE,9),1)
SET D1=A1-B1
SET BUYNOW=IF((D>0 AND C>50),1,0)
SET SELLNOW=IF((D<0 AND C<50),1,0)
SET BUYPAST=IF((D1>0 AND C1>50),1,0)
SET SELLPAST=IF((D1<0 AND C1<50),1,0)
BUYNOW=1 AND SELLPAST=1
FOR SELL :
SET A=EMA(CLOSE,13)
SET B=EMA(CLOSE,21)
SET C=RSI(CLOSE,9)
SET D=A-B
SET A1=REF(A,1)
SET B1=REF(B,1)
SET C1=REF(C,1)
SET D1=REF(D,1)
SET BUYNOW=IF((D>0 AND C>50),1,0)
SET SELLNOW=IF((D<0 AND C<50),1,0)
SET BUYPAST=IF((D1>0 AND C1>50),1,0)
SET SELLPAST=IF((D1<0 AND C1<50),1,0)
SELLNOW=1 AND BUYPAST=1
i am getting ERROR :
your buy script generated an error : undefined function ‘F’
Please tell me where am i doing wrong and change the code to work.
Thanking you
RR2607