Really confused

 

Thank you for anyone who can help me. I've been working on this so long I believe My brain is just fried and I can't think straight. Please Notice the bolded red beginning of an if loop before saying if the ma3 doesn't equal the current stop loss that we should order modify. In the attached document is the journal printing the statement that they are equal (stop loss and ma3). Control shouldn't be passed to the ordermodify function because the values are the same but yet soem how i'm getting the order modify errors....

case 1 :
if(Bid > SOOP60)// && ma3 ! OrderStopLoss())
{
if (ma3 != OrderStopLoss())
{
OrderModify(OrderTicket(),OrderOpenPrice(),ma3, OrderTakeProfit(),0,Blue);
Print("stoploss",DoubleToStr(OrderStopLoss(),Digits));
Print("ma3",DoubleToStr(ma3,Digits));
}
}
else
{
trailsequencer++;
}
break;

FPC

 
 

Can't read the screenshot as its too small.

However, try the "if" statement outside the "switch/case" structure.


CB

 

replace

ma3

with

NormalizeDouble(ma3, Digits)

 

This is working very well, could you explain what exactly is happning to me?

Much appreciated

FXPC

 
FXpipclash:

This is working very well, could you explain what exactly is happning to me?

Much appreciated

FXPC

OrderStopLoss() will return a value which is already normalized to the appropriate number of decimal places.

Chances are your ma3 value may have had some treacherous little values in the less significant digits, throwing your comparison out without you realizing it.


CB

 
cloudbreaker wrote >>

OrderStopLoss() will return a value which is already normalized to the appropriate number of decimal places.

Chances are your ma3 value may have had some treacherous little values in the less significant digits, throwing your comparison out without you realizing it.

CB

CB:

Thanks, I've posted the whole code under forum topic "Posting my EA". Order entry is a random MA crossing designed just to trigger order entry. The real purpose of the code is to handle orders with efficiency (in regards to TP and SL). I was wondering if you could take a look and tell me if there are any serious functionality problems with the EA after Order Entry. It backtests fine but results in an OrderModify error every now and then. The strategy is a slight deviation from the Lebeau stops system.

Thanks,

FXPC

Reason: