Testing Historical Trades with a new Strategy
-
I have a client that is involved in exports, and has strategy that we have developed for the converting of their income funds from USD, EUR, GBP and CAD to ZAR.
I am wanting to test out a strategy for improving on our current one, through back-testing these historical trades using this new strategy.
I have a spreadsheet with the following data from the trades:
- Date/time stamp when these funds were received.
- Date/time stamp when these funds were traded.
- Size of the trade
- Price
What I am wanting to do is to use the received date/time as a trade condition to initiate a buy. And then use the new strategy to execute the sell for each trade. And do this for each of the actual receipts. And then compare results to what was actually achieved
From some research, it would seem the data could (for a start) be pasted in as an array in a custom mql4 block in FXdreema on initialisation. And then the trade conditions lookup can simply loop through this array in sequential order row by row (if my language is correct)?
Once this works, then next level could be to import this from some library file on initialisation.
Does this make sense? If so, can anyone help as to how to go about this?
Thanks in advance
James -
This is a questions for real programmers. Any hint for this gentleman?
-
@l-andorrà I have tried some approaches to open an order at a specific time (Unix Timestamp), but didn't find a solution, yet. If that is done, it looks almost like a no brainer.
-
@trader-philipps Yes, that would be the first step.
Then next would be how best to loop through these trade by trade with an array in a custom block.
Appreciate any assistance / direction. -
@trader-philipps said in Testing Historical Trades with a new Strategy:
@l-andorrà I have tried some approaches to open an order at a specific time (Unix Timestamp), but didn't find a solution, yet. If that is done, it looks almost like a no brainer.
Couldn't you just use the time filter to create a small "window" for the order?
-
@roar I was thinking of this as well on the timer tab. We would need a multi dimensional array (or 2 with the same length) that covers the trade time and the direction Buy/Sell (if that matters). Convert a Unix timestamp to MT4 date and a second one that adjusts it for a couple of seconds.
@DynamOut will there be just 1 trade at a given time? -
@trader-philipps Yes, there would be just one trade at a time for each pair. These would all be buy entries
-
@l-andorrà @trader-philipps @roar
Could anyone assist in how to do this multidimensional array? -
I'm afraid I'm not your man, sorry. I'm not a programmer.

-
@dynamout What I'm asking myself is that timing as also a clue to profitable trades. If your new strategy is compared to the same entries, so you just want to back-test the "new strategy" only for exits?
About how many trades are we talking here? In total and per pair/symbol?
-
@trader-philipps
Yes, to clarify, when the client receives notification of receipt of funds (say USD), he then needs to decide when he will sell those USD to ZAR. (we have the date/time stamp of receipt as well as his conversion date/time stamp & sell price)
We are looking to optimize the strategy for timing the selling of these USD funds to ZAR.
So what we want to do is initiate a USDZAR buy at this time/date stamp and then run our strategy on this trade until it executes a sell signal of this pair. And then compare with what he actually achieved on these trades.
Looking at around 234 trades the past year, mostly on USDZAR and EURZAR but also some GBPZAR and CADZAR, per below.
USD/ZAR 111
EUR/ZAR 96
GBP/ZAR 17
CAD/ZAR 10
Make sense? -
@trader-philipps
Just checking whether you saw this...?