I have an annoying problem with the conditional checking of my trailing stop feature, which causing error 130 (invalid stops)
Here is the condition which will call the SetTrailingStop function when it's returning TRUE (processed on BUY orders)
I've also test it with the simple:
But both of them showing this result when i print it (it will only print when the result TRUE)
As you can see in the Bold, WHY 0.10>0.10 = TRUE ?? which make the EA calls the setTrailingStop function where it shouldn't, thus causing error 130 (invalid stops) because it tries to set the SL of a BUY order to the same price with the Bid.
So, anyone ever experience this kind of thing or know how to resolve it? (i wonder if it's a bug in MT4)
Here is the condition which will call the SetTrailingStop function when it's returning TRUE (processed on BUY orders)
QuoteDislikedif(TrailingStop!=0 && NormalizeDouble(Bid,Digits)-NormalizeDouble(OrderOpenPrice(),Digits)>NormalizeDouble(Point*TrailingStop,Digits) && (NormalizeDouble(Bid,Digits)-NormalizeDouble(OrderStopLoss(),Digits)>NormalizeDouble(Point*TrailingStop,Digits))) SetTrailingStop(...);
I've also test it with the simple:
QuoteDislikedif(TrailingStop!=0 && Bid-OrderOpenPrice()>Point*TrailingStop && (Bid-OrderStopLoss()>Point*TrailingStop)) SetTrailingStop(...);
But both of them showing this result when i print it (it will only print when the result TRUE)
QuoteDislikedUSDJPY BUY TS: 97.84000000-97.73000000(0.11000000)>0.10000000 & 97.84000000-97.74000000(0.10000000)>0.10000000
So, anyone ever experience this kind of thing or know how to resolve it? (i wonder if it's a bug in MT4)