It's been ages since I've done any programming, and never in anything resembling C any more than Pascal.
However, I was reviewing the original source of Phoenix_v4_2_CONTEST.mq4 and I thought the Buy/Sell signals have a big flaw
Code:
//=====================SIGNAL2=======================
bool BuySignal2=false, SellSignal2=false;
double SMA1=iMA(NULL,0,SMAPeriod,0,MODE_SMA,5,1);
double SMA2=iMA(NULL,0,SMAPeriod,0,MODE_SMA,5,SMA2Bars);
if(UseSignal2)
{
if(SMA2-SMA1>0) {BuySignal2 = true;}
if(SMA2-SMA1<0) {SellSignal2 = true;}
}
else {SellSignal2=true;BuySignal2=true;}
The final line "else..." seems like it should best be omitted or at least reset the boolean values to "false". (e.g. if SMA2==SMA1) It would be very unlikely but there is the potential for all five signals for buy and sell to come up true.
Would the EA then attempt to execute both a BUY and a SELL order for the same currency pair?