Backtesting with Virtual Trades?

 

I have an EA that uses virtual trades as part of it's method, before following those by opening real trades, and have been told by the developer that this makes it impossible to run backtests.
So, this got me wondering, firstly if this is actually always the case or if it is just a matter of coding the virtual trades differently so they can work with the MTx Backtest engine?
Also, does MT5 have any better support for this than MT4?

If there is no way to code for backtesting virtual trades with MTx, are there any alternate ways this might be made compatible with backtesting.
e.g. One idea I had was the the EA could have a Backtest Mode where instead of executing it's virtual trades it would place 2x 0.01 real hedged trades, thus having minimal impact on the final outcome, to enable the virtual trade counters to trigger and work it's way towards placing it's real trades.

Anyone got any experience with coding these sort of things or work-around solutions?

 

What he is really saying is that he did not code it yet, or does not want to code it, or does not know how to code it.

But it can certainly be done.

So whenever someone tells you that something is 'impossible' look carefully.

Is it really impossible, or are you dealing with someone who does not know how to do it ? 

 
Marco vd Heijden:

What he is really saying is that he did not code it yet, or does not want to code it, or does not know how to code it.

But it can certainly be done.

So whenever someone tells you that something is 'impossible' look carefully.

Is it really impossible, or are you dealing with someone who does not know how to do it ? 

Or he understood the issues better than those who claims it must be doable ? 😎
 
Marco vd Heijden:

What he is really saying is that he did not code it yet, or does not want to code it, or does not know how to code it.

But it can certainly be done.

So whenever someone tells you that something is 'impossible' look carefully.

Is it really impossible, or are you dealing with someone who does not know how to do it ? 

ok, thanks. So it definitely is possible, correct? Looks like Marco isn't so sure..
Really need a locked down answer on whether it is or not.

Could you give me a basic outline of what is required that is different from coding for normal trading operations?
If anyone knows of any code examples for this type of thing I could link to would be helpful..

 

You have to run multiple tests one for every instrument involved.

You also do that normally but then you just dont look at them as being connected and you generate a separate result for every instrument you test.

In multi instrument strategy every trade has to be logged and in the end all results have to be combined and processed to calculate the final report. 

In backtesting this could mean that you will see the placement of virtual trades on the chart of a different instrument.

These will be virtual and only represent real trades when that particular instrument is the current instrument in the tester. 

It will require a decent amount of coding so you won't usually see any of these strategies on the surface because there it will mostly be single chart single instrument strategy's.

By the way i seen you use MTx but MT4 and MT5 are very different in terms of testing capabilities.

If there are other way's then you might have picked the worst.

 
Soewono Effendi:
Or he understood the issues better than those who claims it must be doable ? 😎

Those who know how to do it are doing it, or at least they did it in the past and have found better solutions over time.

And those who do not know how to do it are saying that it is impossible.

So the end result is self explanatory in this case.

 
Marco vd Heijden:

Those who know how to do it are doing it, or at least they did it in the past and have found better solutions over time.

And those who do not know how to do it are saying that it is impossible.

So the end result is self explanatory in this case.

I would first try to understand what the requirements are before making assumptions or any claims 🤣
 
Soewono Effendi:
I would first try to understand what the requirements are before making assumptions or any claims 🤣

I think that is in the content of post #1.

 
Marco vd Heijden:

You have to run multiple tests one for every instrument involved.

You also do that normally but then you just dont look at them as being connected and you generate a separate result for every instrument you test.

In multi instrument strategy every trade has to be logged and in the end all results have to be combined and processed to calculate the final report. 

In backtesting this could mean that you will see the placement of virtual trades on the chart of a different instrument.

These will be virtual and only represent real trades when that particular instrument is the current instrument in the tester. 

It will require a decent amount of coding so you won't usually see any of these strategies on the surface because there it will mostly be single chart single instrument strategy's.

By the way i seen you use MTx but MT4 and MT5 are very different in terms of testing capabilities.

If there are other way's then you might have picked the worst.

You seem to be referring to strategies that reference multiple symbols. This EA does have capability for some functions that can be performed either based upon multiple instances/charts or individually, depending upon how it is configured. e.g. Chart Drawdown or Account Drawdown.
I expect for backtesting you would configure it to function independently, though I understand MT5 does support MC testing, and only for single tests and not for optimisation.

Sorry, I don't understand what you mean by "..you might have picked the worst.", what are you referring to?

 

There is no need to run multiple charts with such strategy, at least when it is automated.

Multiple charts imply that it is used for a manual strategy and a visual representation.

You can open a virtual position on any time and on any instrument regardless of chart instrument and timeframe.

This means you do it all from one chart that has one expert loaded.

What you can not do in some occasions is place real trades (in tester) and that is why you have to run multiple tests and combine the results.

Maybe i just did not understand your question correctly.


drayzen:

Sorry, I don't understand what you mean by "..you might have picked the worst.", what are you referring to?

If you want to do multi instrument testing then picking MT4 for that might be the worst possible solution you can pick and there could be better ways.

But once more that does not mean that it is 'impossible' 

 

Maybe this can help 

https://www.mql5.com/en/code/22577