wrong sign in the difference between 2 double numbers
You select a position, then access the order.
The order that does the closing of a long position is a sell order.
The closing of a short position is a buy order.
As far as I know, you need to select the order as well, not only the position.
Since I do not use the standard lib, I don't know if positionInfo does that for you.
if(positioninfo.PositionType() == POSITION_TYPE_BUY)
the solution works, thanks guys
if(OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY){ difference = orderPriceClose - orderPriceOpen;Does your code actually compile? Where do you set your variables?
results:
as you can see, the sign of the operation result is wrong. pipsGained should be -9.
this happens only for
what's wrong?
Thanks