Strange Profit on Toolbox->History when Strategy Testing

 

I'm having a strange anomaly with the Strategy Tester.


I have coded a very simple EA that places Buy and Sell stops with SL and TP values. The Volume is calculated to use the difference between the Buy and SL in order to limit the risk to -1% of the account balance as per popular recommendations (excluding Commission for now).

The EA seems to work as coded, and the Buy/SL/TP values look fine when manually checked, however when run through the Strategy Tester I get strange values in the Profit column on the History tab (image snips attached).

My calculations are as follows:

The SL is 28597 and the Price is 30200 which gives us a difference of 1603. Over a volume of 62 shares that is a risk of 99386 or 993.86 in local currency which is just less than the balance in local currency set at the start of the testing.

With this in mind I expect the maximum local currency risk to be a little more than 1000 because of commission (Unless there's a massive market shift of course) and on the live markets this is what happens.


When the SL is hit during testing however it shows a Profit of -2981.58 which is well more than 2x the expected amount. After the transaction commission I come to an expected total of -1103.22.


Does anyone have an idea where the discrepancy comes from or what I'm missing?

Files:
Capture2.JPG  35 kb
Capture3.JPG  84 kb
 
What is the currency set in your Strategy Tester ?
 
Alain Verleyen:
What is the currency set in your Strategy Tester ?
ZAR and the stock is also valued in ZAR cents
 
MasonStonehenge:
ZAR and the stock is also valued in ZAR cents

Yeah, if you are sure about that, there is obviously a problem.

A "live" trade gives correct result ?

 
Alain Verleyen:

Yeah, if you are sure about that, there is obviously a problem.

A "live" trade gives correct result ?

Yes, I'm trying to automate the same strategy that I use live, so I'm checking every trade it performs against those same rules.


Edit:

OK I think I might have narrowed it down to something - the specification of the share says that the currency is 'RSA', but the currency in the strategy tester is 'ZAR' - it adds a RSAZAR converter to the Watch window, and although that should be a constant 0.01 because they are essentially the same thing (one is the cent version of the other), it appears that it has a bid and ask value where the bid is 0.01 as expected, but the ask is 0.03 for some reason which would obviously alter my profit output especially when converting back to ZAR to display.

It seems to act better if I use RSA as my starting money but requires a little tweaking in my EA, but a small price to pay.


TLDR; I think the RSAZAR 'currency pair' is incorrectly defined - it should not have a spread.

 
MasonStonehenge:

Yes, I'm trying to automate the same strategy that I use live, so I'm checking every trade it performs against those same rules.


Edit:

OK I think I might have narrowed it down to something - the specification of the share says that the currency is 'RSA', but the currency in the strategy tester is 'ZAR' - it adds a RSAZAR converter to the Watch window, and although that should be a constant 0.01 because they are essentially the same thing (one is the cent version of the other), it appears that it has a bid and ask value where the bid is 0.01 as expected, but the ask is 0.03 for some reason which would obviously alter my profit output especially when converting back to ZAR to display.

It seems to act better if I use RSA as my starting money but requires a little tweaking in my EA, but a small price to pay.

Make sense, but then you should have the same issue on "live" trading, as I suppose your account is also in ZAR ?

And you probably have this issue only for the losses ?

TLDR; I think the RSAZAR 'currency pair' is incorrectly defined - it should not have a spread.

You need to contact your broker about this.
 
Alain Verleyen:

Make sense, but then you should have the same issue on "live" trading, as I suppose your account is also in ZAR ?

And you probably have this issue only for the losses ?

You need to contact your broker about this.
Thank you for your time!
Reason: