If previous bar=bull/bull then

 

Hi,

I would like to add an extra criterea into my EA's buy/sell logic, currently I am using;

double signalup=iCustom(Symbol(),0,"YangTraderMain",1,1);
double signaldown=iCustom(Symbol(),0,"YangTraderMain",2,1);

&

if (signalup!=EMPTY_VALUE&&signalup!=0)   
      {
      Order = SIGNAL_BUY;
      }

  if (signaldown!=EMPTY_VALUE&&signaldown!=0){ 
      Order = SIGNAL_SELL;
      }

I wish to add a filter, I would only like to buy or sell if the signal bar is either a bull/up bar (if buy) or bear/sell bar (if sell).

I really hope someone can help me out :-)

~WW

 
Check Open[1] vs Close[1] to determine if the previous bar is a Bull or Bear bar . . . and don't forget to check for the Open and Close being equal and don't forget to bear in mind the issue with comparing doubles . . . Can price != price ?
 
RaptorUK:
Check Open[1] vs Close[1] to determine if the previous bar is a Bull or Bear bar . . . and don't forget to check for the Open and Close being equal and don't forget to bear in mind the issue with comparing doubles . . . Can price != price ?

Great, thank you!
Reason: