Download MetaTrader 5

avoid multiple signals while AO is up or down

To add comments, please log in or register
fulltilt
384
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 :-)

// 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;
}
qjol
3243
qjol  
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;
}

 

fulltilt
384
fulltilt  

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

I use:

string Trend;

bool buysignal=true;
bool sellsignal=true;


'=' - unexpected token
qjol
3243
qjol  

why is the 2 conditions:

 

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

in parentheses 

fulltilt
384
fulltilt  

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


same error without parentheses:

'=' - unexpected token
fulltilt
384
fulltilt  
or is it possible to allow new trades only for the first 2 bars of awesome indicator ?
whroeder1
15930
whroeder1  
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.)
fulltilt
384
fulltilt  

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
To add comments, please log in or register