How Strategy Tester calculates profit/loss for a pair that is NOT based on account currency?

 

Hi there,

I am testing my EA on EUR/JPY historical data with USD account. For each trade I calculate risk as PotentialLoss/AccountBalance(), where PotentialLoss = StopLossPips * TradeSizeLots * PipValue and PipValue = 0.01/CurrentRate (0.01 - pip increment for Yen based pairs).  The problem is that PotentialLoss is calculated in Euros while my account balance is in USD. I can't properly calculate risk without converting Euros to USD. So for my EA to calculate risk correctly it has to access EUR/USD rate in that moment in history and this seems to be a issue for Strategy Tester. Is there any workaround for this?.

The other question is how Strategy Tester manages to calculate correct profit/loss values for my USD account? Or does it?

I have 2 installations for MT4 from two different brokers.  I ran my EA on both and I am getting exactly the same trades executed over the same period of time but profit/loss numbers differ between the two. 

Interestingly, one of these testers gives me the correct historical conversion rate to USD.

Can someone shed a light on how Strategy Tester does profit/loss calculation in such case and how reliable it is?

Thanks

 

nshtutman:

I can't properly calculate risk without converting Euros to USD.

The other question is how Strategy Tester manages to calculate correct profit/loss values for my USD account? Or does it?

  1. Of course you can. See my DeltaPerLot
    1. 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.
    2. Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
    3. Do NOT use TickValue by itself - DeltaPerlot
    4. You must normalize lots properly and check against min and max.
    5. You must also check FreeMargin to avoid stop out
  2. The conversion requires the current pairs' value and current base vs account currency at the trade open/close. (conversion changes over time.) The tester only used an approximate constant conversion.
    Testing Features and Limits in MetaTrad*er 4 - MQL4 Articles (except for Bar zero)
 
WHRoeder:
  1. Of course you can. See my DeltaPerLot
    1. 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.
    2. Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
    3. Do NOT use TickValue by itself - DeltaPerlot
    4. You must normalize lots properly and check against min and max.
    5. You must also check FreeMargin to avoid stop out
  2. The conversion requires the current pairs' value and current base vs account currency at the trade open/close. (conversion changes over time.) The tester only used an approximate constant conversion.
    Testing Features and Limits in MetaTrad*er 4 - MQL4 Articles (except for Bar zero)

Thanks. Eye opening...

Your links led me to more information I wasn't able to find otherwise.

What's DIR in your formula?

For testing purposes though I think it is better to set account currency to one of the pair's currencies to avoid "guessed" profit/loss numbers. In the end of the day I am interested to see EA performance as a percentage of initial deposit, no matter what is deposit currency.

 
+1 buy -1 sell
Reason: