avoid multiple signals while AO is up or down

 

how can I prevent multiple signals in a EA?

If AO is up it should only trigger one signal at the beginning and wait until AO is below 0.0000

I'll tried this but without success :-)

// Awesome
double aog = iCustom(Symbol(),0,"Awesome",1,CandleShift);//green
double aor = iCustom(Symbol(),0,"Awesome",2,CandleShift);//red
   
if (aog>0.00000) 
{
Trend="buying trend";
}

if (aor<0.00000) 
{
Trend="selling trend";
}

// buy condition
if ((buysignal==true&&Trend!="buying trend") && (MA1 > MA2 + MinDistance * pips2dbl && Bid >= Open[0]))
{
  Buy=true;
}

// sell condition
if ((sellsignal==true&&Trend!="selling trend") && (MA1 < MA2 + MinDistance * pips2dbl && Ask <= Open[0]))
{
  Sell=true;
}
 
fulltilt:

how can I prevent multiple signals in a EA?

If AO is up it should only trigger one signal at the beginning and wait until AO is below 0.0000

I'll tried this but without success :-)

if ((buysignal==true&&Trend=="buying trend") && (MA1 > MA2 + MinDistance * pips2dbl && Bid >= Open[0]))
{
  Buy=true;
}

// sell condition
if ((sellsignal==true&&Trend=="selling trend") && (MA1 < MA2 + MinDistance * pips2dbl && Ask <= Open[0]))
{
  Sell=true;
}

 

 

hmm, if I use == I get following error:

I use:

string Trend;

bool buysignal=true;
bool sellsignal=true;


'=' - unexpected token
 

why is the 2 conditions:

 

(buysignal==true&&Trend=="buying trend")

in parentheses 

 

is there any other way to get it work - trigger signal only once at the beginning?


same error without parentheses:

'=' - unexpected token
 
or is it possible to allow new trades only for the first 2 bars of awesome indicator ?
 
fulltilt: how can I prevent multiple signals in a EA? If AO is up it should only trigger one signal at the beginning and wait until AO is below 0.0000
double aog = iCustom(Symbol(),0,"Awesome",1,CandleShift);//green
double aor = iCustom(Symbol(),0,"Awesome",2,CandleShift);//red
if (aog>0.00000)
Don't look at for a level, look for a change in signal
static double aog=0.0;
double aogPrev = aog;
aog = iCustom(Symbol(),0,"Awesome",1,CandleShift);//green

if (aog>0.00000 && aogPrev < 0.)
 

edit ### thank you will try it

if (aog>0.00000 && aogPrev < 0.) 


thank you, I added a max value ... no it works :-)

aog>0.00002 && aog<0.0006
Reason: