Discussion of article "How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester"

 

New article How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester has been published:

Tutorial to build and test a Binary Options strategy in Strategy-Tester of Metatrader 4 with Binary-Options-Strategy-Tester utility from marketplace.

The concept contains the following parts:

Binary Options Strategy Tester Concept

This is a step by step example how to build a Binary Options strategy stored in an Indicator (marked as red in image above) to communicate through Binary-Options-Strategy-Library with the Binary-Options-Strategy-Tester, to place virtual orders and count their results with backtests and forward tests.

Author: Martin Amiri

 

Thanks Martin

Great work 

 
Mohammad Soubra:

Thanks Martin

Great work 

Hey Mohammad,

Thank you very much!

Regards,

Martin 

 
Hi Martins, thats a great job. At the very start of the process I get an error message " can't open 'C ..............................' include folder". I do not know what has gone wrong. Would the strategy allow one to forward test a strategy built on multiple strategy?
 
juwohall1:
Hi Martins, thats a great job. At the very start of the process I get an error message " can't open 'C ..............................' include folder". I do not know what has gone wrong. Would the strategy allow one to forward test a strategy built on multiple strategy?

Hi juwohall1,

Thank you!

May I aks you to specify the problem a little more:

- Could you provide the complete error message

- At wich time the error occurs (e.g. building your strategy file or drag the strategy file on the running tester)? 

- Which version of the BinaryOptionsStrategyLibrary do you use, v1.0 or v1.1 (relatet to the changelog at the end of the page: https://www.mql5.com/en/code/16659)?

- At which folder your BinaryOptionsStrategyLibrary is locatet ([Path to your MT4]/MQL4/Include)?

- Do you use the demo or a purchased version of BinaryOptionStrategyTester?

You can build mulitple strategy (multiple strategy rules) in one strategy file or several strategy files to use them all in a back test or foreward test. But the settings of BinaryOptionsStrategyTester (e.g. max allowed simultaneous buy orders) will be used. So if strategy 1 places a trade maybe strategy 2 could not place a trade e.g. at the same time or same candle related to your settings.

Regards,

Martin 

Binary Options Strategy Library
Binary Options Strategy Library
  • votes: 3
  • 2016.12.22
  • Martin Amiri
  • www.mql5.com
Build Binary Options strategies to test in the Strategy Tester of MetaTrader 4 with Binary Options Strategy Tester utility from marketplace.
 

Hi Martin,

1- The fuller form of the error code: " can't open 'C' \ Terminal\............\MQL4\include\BinaryOptionStrategyLibrary.mqh" include forlder.

2- The error code shows up as soon as I hit 'compile' in order to compile the BinaryOptionStrategyExample.mq4. Then 8 other error codes follow: printdebug value, callStrategy, placetrade all- funtion not defined.

3- The BinaryOptionStrategyLibrary is v1.01 while the BinaryOptionStrategyExample is v 1.0.

4- I have not got any yet but will go for the purchased version.

By multiple strategy i actually meant ' a strategy built on candle or indicator data for more than one timeframe, say 15M and 30M time frame for one strategy for example.

Regards,

Johnson. 

 
juwohall1:

Hi Martin,

1- The fuller form of the error code: " can't open 'C' \ Terminal\............\MQL4\include\BinaryOptionStrategyLibrary.mqh" include forlder.

2- The error code shows up as soon as I hit 'compile' in order to compile the BinaryOptionStrategyExample.mq4. Then 8 other error codes follow: printdebug value, callStrategy, placetrade all- funtion not defined.

3- The BinaryOptionStrategyLibrary is v1.01 while the BinaryOptionStrategyExample is v 1.0.

4- I have not got any yet but will go for the purchased version.

By multiple strategy i actually meant ' a strategy built on candle or indicator data for more than one timeframe, say 15M and 30M time frame for one strategy for example.

Regards,

Johnson. 

Hi Johnson,

Thank you for specifying the situation!

Please take a look at the unanswered question "- At which folder your BinaryOptionsStrategyLibrary is locatet ([Path to your MT4]/MQL4/Include)?" and check where you have placed the BinaryOptionsStrategyLibrary.mqh. 

To make a build without errors please make shure the BinaryOptionsStrategyLibrary.mqh (v1.01) is placed into folder [path to your MT4]\MQL4\Include e.g. by clicking on "Include" folder in navigator of Metaquotes Language Editor (see picture below). If the library is stored into folder [path to your MT4]\MQL4\Include, BinaryOptionsStrategyExample.mq4 should compile without any errors (see picture below).

 


A little more dedailed: 

The only way to repruduce the error is to not place the BinaryOptionsStrategyLibrary.mqh file into include folder of the MT4 so the BinaryOptionsStrategyExample can not open it like described in the error message:

"can´t open 'C:\....\MQL4\Include\BinaryOptionsStrategyLibrary.mqh include folder.". 

 

If the BinaryOptionsStrategyLibrary.mqh could not be found in folder "Include" of your MT4, the BinaryOptionsStrategyExample can not call further needed methods of the library which will result in the next errors (see picture above).

As you can see in picture below BinaryOptionsStrategyLibrary.mqh is included with "#include" in line 12 in BinaryOptionsStrategyExample.mq4. Therefore the library has to be placed into "Include" folder to be available for the "#import". If you click on "Include" in navigator of Metaquotes Language Editor you can see if BinaryOptionsStrategyLibrary is locatet in folder "Include" of your MT4. If BinaryOptionsLibrary is not shown (and therefore not stored into "Include" folder) the build will result in the described error (see picture below).

 

 

The solution should be to place the BinaryOptionsStrategyLibrary.mqh (v1.01) into folder [Path to your MT4]\MQL4\Include like described in the article in section "2. Installation" or in section "Installation" of BinaryOptionsStrategyLibrary.

 

Extract section 2. Installation of the article:


...

2. Installation
... 

Download free BinaryOptionsStrategyLibrary.mqh and place it in into folder \Include ([path to your MetaTrader 4]\MQL4\Include):

...


 

Extract section Installation of BinaryOptionsStrategyLibrary:


... 

Installation:

Download this library (BinaryOptionsStrategyLibrary.mqh) and place it into\Include folder ([path to your MetaTrader 4]\MQL4\Include). After that you are able to use the functions by including the file (see Usage).
...



I hope the explanation will help to build the BinaryOptionsStrategyExample and BinaryOptionsStrategyTester will help you to test and improve your Binary Options strategies!

Yes, in forward tests it is possible to build a strategy based on mulitple timeframes of a currency.  

If you have any questions please feel free to contact me or to place any questions here!

I would be happy to hear from you if the build could be done!

Regards,

Martin 

How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester
How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester
  • 2016.12.22
  • Martin Amiri
  • www.mql5.com
Tutorial to build a Binary Options strategy an test it in Strategy-Tester of MetaTrader 4 with Binary-Options-Strategy-Tester utility from marketplace.
 
Martin Amiri:

Hi Johnson,

Thank you for specifying the situation!

Please take a look at the unanswered question "- At which folder your BinaryOptionsStrategyLibrary is locatet ([Path to your MT4]/MQL4/Include)?" and check where you have placed the BinaryOptionsStrategyLibrary.mqh. 

To make a build without errors please make shure the BinaryOptionsStrategyLibrary.mqh (v1.01) is placed into folder [path to your MT4]\MQL4\Include e.g. by clicking on "Include" folder in navigator of Metaquotes Language Editor (see picture below). If the library is stored into folder [path to your MT4]\MQL4\Include, BinaryOptionsStrategyExample.mq4 should compile without any errors (see picture below).

 


A little more dedailed: 

The only way to repruduce the error is to not place the BinaryOptionsStrategyLibrary.mqh file into include folder of the MT4 so the BinaryOptionsStrategyExample can not open it like described in the error message:

"can´t open 'C:\....\MQL4\Include\BinaryOptionsStrategyLibrary.mqh include folder.". 

 

If the BinaryOptionsStrategyLibrary.mqh could not be found in folder "Include" of your MT4, the BinaryOptionsStrategyExample can not call further needed methods of the library which will result in the next errors (see picture above).

As you can see in picture below BinaryOptionsStrategyLibrary.mqh is included with "#include" in line 12 in BinaryOptionsStrategyExample.mq4. Therefore the library has to be placed into "Include" folder to be available for the "#import". If you click on "Include" in navigator of Metaquotes Language Editor you can see if BinaryOptionsStrategyLibrary is locatet in folder "Include" of your MT4. If BinaryOptionsLibrary is not shown (and therefore not stored into "Include" folder) the build will result in the described error (see picture below).

 

 

The solution should be to place the BinaryOptionsStrategyLibrary.mqh (v1.01) into folder [Path to your MT4]\MQL4\Include like described in the article in section "2. Installation" or in section "Installation" of BinaryOptionsStrategyLibrary.

 

Extract section 2. Installation of the article:


...

2. Installation
... 

Download free BinaryOptionsStrategyLibrary.mqh and place it in into folder \Include ([path to your MetaTrader 4]\MQL4\Include):

...


 

Extract section Installation of BinaryOptionsStrategyLibrary:


... 

Installation:

Download this library (BinaryOptionsStrategyLibrary.mqh) and place it into\Include folder ([path to your MetaTrader 4]\MQL4\Include). After that you are able to use the functions by including the file (see Usage).
...



I hope the explanation will help to build the BinaryOptionsStrategyExample and BinaryOptionsStrategyTester will help you to test and improve your Binary Options strategies!

Yes, in forward tests it is possible to build a strategy based on mulitple timeframes of a currency.  

If you have any questions please feel free to contact me or to place any questions here!

I would be happy to hear from you if the build could be done!

Regards,

Martin 

Hi Martin,

That was a grand explanation! All in one!

I am sure I have more question and will contact you. Thanks and Regards,

Johnson. 

 
juwohall1:

Hi Martin,

That was a grand explanation! All in one!

I am sure I have more question and will contact you. Thanks and Regards,

Johnson. 

Hi Johnson,

Thank you, I am glad to hear that!

Regards,

Martin 

 

Hi Martin,

is it possible to let the MT4 optimizer optimize my strategy? 

 

Regards,

flo 

 
Florian Grünwald:

Hi Martin,

is it possible to let the MT4 optimizer optimize my strategy? 

 

Regards,

flo 

Hi Flo,

Unfortunately it is not possible to let the optimizer optimize your strategy..

Why:

As the strategy tester of MT4 can not handle Binary Option trades with expire times by himself, Binary Options Strategy Tester runs in strategy tester of MT4 and places virtual orders to count/display their results:

 

Unfortunately it is not possible to pass the virtual results to the MT4 strategy tester. Therefore the virtual orders are not known by the strategy tester of MT4 himself and can not be calculated or optimized automatically.

But you can define values of your strategy in your strategy indicator file as external inputs/variables (https://www.mql5.com/en/articles/2820#p321) to change parameters easily and to run your strategy several times with different settings to compare the results.

I will enhance the Binary Options Strategy Tester in the next version to print out a textfile with the current settings and the results to make it easier to compare them.

I hope Binary Options Strategy Tester will still help you to check your strategies for long time periods in short times automatically and to improve your strategies.

If you have any further questions don´t hasitate to contact me!

Regards,

Martin 

Reason: