Download MetaTrader 5

avoid multiple signals while AO is up or down

To add comments, please log in or register
Publish your article. We will translate it into other languages!
fulltilt
372
fulltilt 2014.09.24 09:51 

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 2014.09.24 10:21  
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
372
fulltilt 2014.09.24 12:17  

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

I use:

string Trend;

bool buysignal=true;
bool sellsignal=true;


'=' - unexpected token
qjol
3243
qjol 2014.09.24 12:25  

why is the 2 conditions:

 

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

in parentheses 

fulltilt
372
fulltilt 2014.09.24 12:41  

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


same error without parentheses:

'=' - unexpected token
fulltilt
372
fulltilt 2014.09.24 14:05  
or is it possible to allow new trades only for the first 2 bars of awesome indicator ?
whroeder1
14532
whroeder1 2014.09.24 14:28  
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
372
fulltilt 2014.09.24 16:05  

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