avoid multiple signals while AO is up or down

To add comments, please log in or register
384

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;
}```
3243

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;
}```

384

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

I use:

string Trend;

bool buysignal=true;
bool sellsignal=true;

`'=' - unexpected token`
3243

why is the 2 conditions:

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

in parentheses

384

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

same error without parentheses:

`'=' - unexpected token`
384

or is it possible to allow new trades only for the first 2 bars of awesome indicator ?
15930

 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.0000double 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 signalstatic double aog=0.0; double aogPrev = aog; aog = iCustom(Symbol(),0,"Awesome",1,CandleShift);//green if (aog>0.00000 && aogPrev < 0.)
384

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