How to calculate take profit from currency - page 2

 
Dominik Egert #:
Your formula is wrong.

For reference, you will need to look at MQL5 docs, I wasn't able to find the appropriate page in MQL4 docs.


There is only one asset type with a profit formula that does not use contract size, and that is Futures.

Since you are not using futures contracts, I conclude, you are using the wrong formula.

Note, mql4 supports less types than mql5 does. But you need to look up what type you are actually using to determine the correct formula.

Thank you for your response. I think now it is more clear for me, I was trying to use too much informations available in the SymbolInfo. Those 2 equations works for CFD :

SYMBOL_CALC_MODE_CFD

CFD mode - calculation of margin and profit for CFD

Margin: Lots * ContractSize * MarketPrice * Margin_Rate

 

Profit:  (close_price - open_price) * Contract_Size * Lots

SYMBOL_CALC_MODE_CFDINDEX

CFD index mode - calculation of margin and profit for CFD by indexes

Margin: (Lots * ContractSize * MarketPrice) * TickPrice / TickSize * Margin_Rate

 

Profit:  (close_price - open_price) * Contract_Size * Lots


EURJPY :    with for example 1 lot and open price 155, close price 156 and trade_contract_size=100000.0
-> profit = (156-155) * 100000 * 1 = 100000 JPY so arround 700 USD

XAUUSD :  with 1 lot, open price 2500, close price 2510 and  trade_contract_size=100.0
-> profit = (2510-2500) * 100 * 1 = 1000 USD