How to calculate OrderProfit()?

Back to topics list To post a new topic, please log in or register
avatar
6
xin2014 2015.01.06 08:04
 

Sombody tell me I can use the below calculation formula get the value of OrderProfit()


(OrderClosePrice()-OrderOpenPrice())*OrderLots()*MarketInfo(OrderSymbol(),MODE_TICKVALUE)/Point

So I test it in a EA file.

        profit=OrderProfit();

       Calprofit=(OrderClosePrice()-OrderOpenPrice())*OrderLots()*MarketInfo(OrderSymbol(),MODE_TICKVALUE)/Point;

       Print(TimeCurrent(),":","close",OrderTicket(),",","Profit="+profit,",","CalProfit="+Calprofit);


But I found in the result log file, the profit is not equal Calprofit.

Is there something wrong?

Hope can get your help, thanks a lot!

avatar
2017
gooly 2015.01.06 08:48 #
 
There are costs that are not considered by OrderProfit() - read the reference, you'll find it there!
avatar
12985
WHRoeder 2015.01.06 17:34 #
 
MarketInfo(OrderSymbol(),MODE_TICKVALUE)/Point;

There is Tick, PIP, and Point. They are all different in general. A tick is the smallest change of price. A Point is the least significant digit quoted. In currencies a pip is defined as 0.0001 (or for JPY 0.01)

On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a 5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must adjust pips to points (for mq4.) In currencies a tick is a point. Price can change by least significant digit (1.23456 -> 1.23457)

In metals a Tick is still the smallest change but is larger than a point. If price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a point of 0.01. Pip has no meaning.

This is why you don't use TickValue by itself. Only as a ratio with TickSize. See DeltaValuePerLot()

Back to topics list  

To add comments, please log in or register