OrderStopLoss() !!!

 

Hello all,

Just to tell you, I saw OrderStopLoss() function returned value on the 16th digit on decimal part.


That mean, if you have a condition like that, Stop < OrderStopLoss() with these values in the log file Stop = 1.36190000 & OrderStopLoss()=1.36190000, it could be TRUE.

Because OrderStopLoss() didn't return 1.36190000 as you can see in your log file but it return for exemple 1.3619000000000002


To avoid this issue, I suggest to use the NormalizeDouble() function like that -> NormalizeDouble(OrderStopLoss(),Digits)


I didn't check yet other functions but it could be the same issue on OrderTakeProfit( ), OrderOpenPrice( ) and so on....


bye

Wap

 
wapzzoo:

Hello all,

Just to tell you, I saw OrderStopLoss() function returned value on the 16th digit on decimal part.


That mean, if you have a condition like that, Stop < OrderStopLoss() with these values in the log file Stop = 1.36190000 & OrderStopLoss()=1.36190000, it could be TRUE.

Because OrderStopLoss() didn't return 1.36190000 as you can see in your log file but it return for exemple 1.3619000000000002


To avoid this issue, I suggest to use the NormalizeDouble() function like that -> NormalizeDouble(OrderStopLoss(),Digits)


I didn't check yet other functions but it could be the same issue on OrderTakeProfit( ), OrderOpenPrice( ) and so on....


bye

Wap

Or just ensure to use <= or >= conditional statements in this sort of logic, rather than == statements.

 
wapzzoo:

Hello all,

Just to tell you, I saw OrderStopLoss() function returned value on the 16th digit on decimal part.


That mean, if you have a condition like that, Stop < OrderStopLoss() with these values in the log file Stop = 1.36190000 & OrderStopLoss()=1.36190000, it could be TRUE.

Because OrderStopLoss() didn't return 1.36190000 as you can see in your log file but it return for exemple 1.3619000000000002


To avoid this issue, I suggest to use the NormalizeDouble() function like that -> NormalizeDouble(OrderStopLoss(),Digits)


I didn't check yet other functions but it could be the same issue on OrderTakeProfit( ), OrderOpenPrice( ) and so on....


bye

Wap

Pity I didn't read this before I spent so many hours trying unsuccessfully to sort out my bug. It does indeed work after you use a NomalizeDouble. However I think it is also doing other weirdness as well because the value returned seems to be the previous OrderStopLoss not the current one after an OrderModify of the stop loss value.
Reason: