Download MetaTrader 5

Question about Tester Commisions and Swaps

To add comments, please log in or register
Konstantinos Papamarkou
2482
Konstantinos Papamarkou  

Another proof why an EA has most of times completely different results on live. Imagine that bug on a live account with real money, easy way to lose your money thinking that it is because a bad robot. No always! Sometimes may be because of a platform bug.

On tester, orders 3 & 4 close with pips gain, but tester give us a negative profit as a result! 

Isn't it "wonderful"? 

 

Carl Schreiber
Moderator
7958
Carl Schreiber  
Calm down - most probable the tester calculated with swap-costs (Nov. 14 - Dec. 8) or/and commission.
Fernando Carreiro
3921
Fernando Carreiro  
KONSTANTINOS PAPAMARKOU: Another proof why an EA has most of times completely different results on live. Imagine that bug on a live account with real money, easy way to lose your money thinking that it is because a bad robot. No always! Sometimes may be because of a platform bug. On tester, orders 3 & 4 close with pips gain, but tester give us a negative profit as a result! Isn't it "wonderful"? 

P.I.C.N.I.C. - Problem in chair, not in computer!

Forum on trading, automated trading systems and testing trading strategies

Is SWAP correctly calculated in MT4 Strategy Tester?

whroeder1, 2014.05.12 11:13

Testing Features and Limits in MetaTrader 4 - MQL4 Articles
  • All swaps, margin requirements, expirations, GTC-orders are modeled

    Testing is performed maximally closely to trading server conditions. But the can occur some inaccuracies in estimation of margin requirements on cross currencies because of lack of precise information about conversion prices at each moment.


Is SWAP correctly calculated in MT4 Strategy Tester?
Is SWAP correctly calculated in MT4 Strategy Tester?
  • www.mql5.com
Hi All, Does anybody know that is SWAP correctly calculated in MT4 Strategy Tester? I have found many different information about it...
Konstantinos Papamarkou
2482
Konstantinos Papamarkou  

I had never tested a long term strategy before so i never noticed it. 

So let me ask you something else, is there any way to convert commissions and swaps form profit in eur/usd/etc (as they are returned by OrderCommision and OrderSwap functions) to p/l in points? 

Fernando Carreiro
3921
Fernando Carreiro  
KONSTANTINOS PAPAMARKOU:

I had never tested a long term strategy before so i never noticed it. 

So let me ask you something else, is there any way to convert commissions and swaps form profit in eur/usd/etc (as they are returned by OrderCommision and OrderSwap functions) to p/l in points? 

Commissions can be represented as an equivalent value in pips yes, but not swaps as that is dependent on how long the order remains open and if it is hit by the triple swap day or not.

Here is an example (but will differ depending on some factors, for which you will have to change depending on your case):

The number of Pips that your commission ($ per million) represents in the case of GBP/USD and a USD Account Balance can be calculated as follows:

Pip Equivalent = Currency Price * Commission Rate * 2 Operations / 100

For example, if your GBP/USD Price is 1.62012 and your commission is $35 per million, then
Pip Equivalent = 1.62012 * 35 * 2 / 100 = 1.134084 ~ 1.2 pips (after ceiling adjustment)

If your average spread is 0.94 pips and commission is 1.2 pips, then total cost is 2.14 pips average.

EDIT: More details:
The "100" has nothing to do with percentage but rather the resultant value after factoring Contract Size and Pip Value for a Standard Lot of volume.

Here is the correct calculation in detail:
Contract Size = 100000 (Standard Lot Contract Size)
Pip Value = $10.00 (for Standard Lot of ???/USD and USD Account Balance)
Currency Price = 1.62012 (example for GBP/USD)
Value = Currency Price x Contract Size = $162012.00
Turnover = Value x 2 (open & close) = $324024.00
Commission Value = $35.00
Commission Scale = $1000000.00 (Million $)
Commission Rate = Commission Value / Commission Scale = 0.000035
Commission per Trade = Turnover x Commission Rate = $11.34084
Commission in Pips = Commission per Trade / Pip Value = 1.134084 pips

Thus the resultant simplified calculation is as follows:
Commission in Pips = Currency Price * Commission Value * 2 / 100
Commission in Pips = Currency Price * Commission Value / 50

EDIT2:
However, please note that this is an approximation, as we are using the same Currency Price for both the Open and Close of the Trade. To be exact, we would have to calculate separate commissions for the opening price and closing price, but the resulting difference from the above calculation is negligible. But if you wish, just use the average price between the opening and closing prices, in the calculation, for a better approximation.
Please note that this is only an example and depends on how commission is defined by your broker and in what currency it is expressed.

EDIT: Do a search as well. I found the following:

How to calculate commission as spread?
How to calculate commission as spread?
  • www.mql5.com
5 points, same time broker charged Commission as per "Round-turn $4 once 1 lot position is opened.
whroeder1
17097
whroeder1  
KONSTANTINOS PAPAMARKOU:is there any way to convert commissions and swaps form profit in eur/usd/etc (as they are returned by OrderCommision and OrderSwap functions) to p/l in points? 
  1. do your algebra
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
  2. You can't convert swap as that depends on how many days you have the order open.
To add comments, please log in or register