Download MetaTrader 5

MT4 multicurrency backtesting in tester environment - writting trading decisions into .csv

To add comments, please log in or register
kavaro
368
kavaro  
Great people!
I need a help:

did anybody tackled this? : MT4 multicurrency backtesting in tester environment:

Im thinking that EA could write comments in .csv about what trading decisions it would do.. while it can really only trade one currency pair in the MT4 Tester...so I can collect account statement from the .csv with all the comments as in demo or live trading

Im having a problem with

2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: Failed to open position USDCHF Buy Limit Current Price = 0.00000 Open Price = -0.004 Stop Loss = -0.011 Take Profit = 0.014 Error = 4059
2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: OrderSend error 4106
2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: unknown symbol name USDCHF for OrderSend function



ERR_UNKNOWN_SYMBOL4106Unknown symbol.
ERR_FUNCTION_NOT_ALLOWED_IN_TESTING _MODE4059Function is not allowed in testing mode.

how we can tackle this to go around in some way?

I appreciate any help!
Nguyen Nga
8634
Nguyen Nga  

MT4 can not backtest multi currency.  

But it is ok if your EA write orders to csv file.

Stanislav Korotky
19832
Stanislav Korotky  
kavaro:

did anybody tackled this? : MT4 multicurrency backtesting in tester environment:

Im thinking that EA could write comments in .csv about what trading decisions it would do.. while it can really only trade one currency pair in the MT4 Tester...so I can collect account statement from the .csv with all the comments as in demo or live trading

Im having a problem with

2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: Failed to open position USDCHF Buy Limit Current Price = 0.00000 Open Price = -0.004 Stop Loss = -0.011 Take Profit = 0.014 Error = 4059
2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: OrderSend error 4106
2016.08.24 09:56:38.326 2016.08.22 03:18 Momentum_26_test EURJPY,M15: unknown symbol name USDCHF for OrderSend function



ERR_UNKNOWN_SYMBOL4106Unknown symbol.
ERR_FUNCTION_NOT_ALLOWED_IN_TESTING _MODE4059Function is not allowed in testing mode.

how we can tackle this to go around in some way?

You are perfectly right. This is a very simple way of multicurrency testing in MT4: send orders in current symbol as is, and store the others into csv-log, which then can be "re-played" in other special expert trading by this log.

The errors you see do not harm. The tester continue working and trading on the work symbol.

Disclaimer. This is only applicable if trading strategy uses constant lots for every symbol.

kavaro
368
kavaro  
Stanislav Korotky:

You are perfectly right. This is a very simple way of multicurrency testing in MT4: send orders in current symbol as is, and store the others into csv-log, which then can be "re-played" in other special expert trading by this log.

The errors you see do not harm. The tester continue working and trading on the work symbol.

Disclaimer. This is only applicable if trading strategy uses constant lots for every symbol.

Stanislav,

thank you for your response. You have the same name as my Father in Law So I will look at your comments and directions in the same way as with him... With respect.

 

Have two questins for you:

 

1) can we build EA that way, that currency pairs that are copied in the .csv are also checked by the EA concerning SL/TP etc... and the result is already in the .csv following the initial orders?

 

2) What do you mean by this? "re-played" system. Is there any kind of this on the web already?

 

pls, if you have any other idea let me know, thank you Sir

 

Stanislav Korotky
19832
Stanislav Korotky  
kavaro:

Have two questins for you:

1) can we build EA that way, that currency pairs that are copied in the .csv are also checked by the EA concerning SL/TP etc... and the result is already in the .csv following the initial orders?

2) What do you mean by this? "re-played" system. Is there any kind of this on the web already?

Unfortunately, this approach is limited in a sense that only part of trading operations can be logged in the csv. For example, we can save buy or sell signals (which can be lately re-played as market orders or pending oprders) but can not save SL/TP modifications which could be initiated if the order was opened/placed. Indeed, since the order is skipped (because its symbol is unknown) all futher possible commands that could be applied on it are impossible (for example, trailing stop). Nevertheless, you can save enter/exit/partial close signals and optionally unmodifiable SL/TP levels.

I have such simple system, but the "replayer" expert is bound to a custom expert library. If I have spare time, I could simplify it by replacing this dependency with standard OrderSend/OrderClose functions.

Most interesting though is that all these bells and whistles are not needed in many cases. For example, I have been running multicurrency EA testing in MT4 for years without this system. For my strategies it is sufficient to run tests on different work symbols one by one, and then I merge reports. But. This requires some other (external) code to parse htmls and to build consolidated report.

kavaro
368
kavaro  
Stanislav Korotky:

Unfortunately, this approach is limited in a sense that only part of trading operations can be logged in the csv. For example, we can save buy or sell signals (which can be lately re-played as market orders or pending oprders) but can not save SL/TP modifications which could be initiated if the order was opened/placed. Indeed, since the order is skipped (because its symbol is unknown) all futher possible commands that could be applied on it are impossible (for example, trailing stop). Nevertheless, you can save enter/exit/partial close signals and optionally unmodifiable SL/TP levels.

I have such simple system, but the "replayer" expert is bound to a custom expert library. If I have spare time, I could simplify it by replacing this dependency with standard OrderSend/OrderClose functions.

Most interesting though is that all these bells and whistles are not needed in many cases. For example, I have been running multicurrency EA testing in MT4 for years without this system. For my strategies it is sufficient to run tests on different work symbols one by one, and then I merge reports. But. This requires some other (external) code to parse htmls and to build consolidated report.


"Most interesting though is that all these bells and whistles are not needed in many cases. For example, I have been running multicurrency EA testing in MT4 for years without this system. For my strategies it is sufficient to run tests on different work symbols one by one, and then I merge reports. But. This requires some other (external) code to parse htmls and to build consolidated report"


I see. Agreed, probably my best version is gonna be like this. Testing each pair on its own, but taking all the market in 20++ pairs.

Hm, merging the report can be interesting stuff ya. Especially if one wants to do it properly. I love mt4 but hate is as much.


Another question pls:

I downloaded 1m data from dukascopy for 7y plus on this 20+ currency pairs. I havent modified them yet for Mt4 compliance.

What I found out in the past is that whereas I had offline version of mt4 with all relevant data for my testing..the tester didnt want to trade 2012/2013 years even thou all data was inside the program. Cant remember the error. Have you ever had problems similar to these? 


If you have a spare time for your replayer im very much interested in your help of course.

Either way, thank you for your support

Stanislav Korotky
19832
Stanislav Korotky  
kavaro:

I see. Agreed, probably my best version is gonna be like this. Testing each pair on its own, but taking all the market in 20++ pairs.

Hm, merging the report can be interesting stuff ya. Especially if one wants to do it properly. I love mt4 but hate is as much.

I don't know what is "properly" - everyone can think on its own. For example, I use special html+javascript pages which do it for me in a browser.

MT4 report merger (consolidated multicurrency balance from several tester runs)


MT4 report comparison (balances of test result on multiple currencies) 

 

Another question pls:

Alas, I have nothing to say about this.

 

If you have a spare time for your replayer im very much interested in your help of course.

Please find a simple EA attached which demonstrates the trade signals player metaphor. I provide it "as is", it may lack many features you need and contain bugs. ;-)

Files:
Stanislav Korotky
19832
Stanislav Korotky  

Last but not the least, all these methods discussed above do not allow multicurrency optimization (every symbol used must be optimized separately, which is not applicable for specific strategies such as pair or basket traiding for example).

If your EA is not bound to specific MT4 indicators and works either without indicators or based on standard indicators (having analogues in MT5), you could probably move your EA to MT5 with minimal changes or even "as is" using this library, recently published in the codebase. I provide a link to Russian page because English translation is not available yet (at the time of writing). Then you'll be able not only to run multicurrency tests but also multicurrency optimizations.

kavaro
368
kavaro  
Stanislav Korotky:

I don't know what is "properly" - everyone can think on its own. For example, I use special html+javascript pages which do it for me in a browser.


 

 

Alas, I have nothing to say about this.

 

Please find a simple EA attached which demonstrates the trade signals player metaphor. I provide it "as is", it may lack many features you need and contain bugs. ;-)

yes, you have all the main attributes to look into. very good


Ill try to develop something out of this. thank you for support

kavaro
368
kavaro  
Stanislav Korotky:

Last but not the least, all these methods discussed above do not allow multicurrency optimization (every symbol used must be optimized separately, which is not applicable for specific strategies such as pair or basket traiding for example).

If your EA is not bound to specific MT4 indicators and works either without indicators or based on standard indicators (having analogues in MT5), you could probably move your EA to MT5 with minimal changes or even "as is" using this library, recently published in the codebase. I provide a link to Russian page because English translation is not available yet (at the time of writing). Then you'll be able not only to run multicurrency tests but also multicurrency optimizations.

I had developed Mt5 system also, but as said..mt4/5 have some odd thing inside..that when offline, they do not want to test some of the previous years. Plus, they just stop trading as EA wants to trade...in early periods it trades ok...but later on just does not wanna trade anymore. Very odd. No problem with comp or disk room or something similar..seems like a bug in the system.


that is why I asked if one had same issues anytime.

Stanislav Korotky
19832
Stanislav Korotky  
kavaro:

I had developed Mt5 system also, but as said..mt4/5 have some odd thing inside..that when offline, they do not want to test some of the previous years. Plus, they just stop trading as EA wants to trade...in early periods it trades ok...but later on just does not wanna trade anymore. Very odd. No problem with comp or disk room or something similar..seems like a bug in the system.


that is why I asked if one had same issues anytime.

Can you provide tester logs? It usually indicates errors with history.
123
To add comments, please log in or register