Binary Options Strategy Library – library MetaTrader 4

This library provides input parameters and functions to build your Binary Options strategy stored in an indicator to test and improve your strategy in the Strategy Tester of MetaTrader 4 with the Binary Options Strategy Tester utility from Marketplace.


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). 


Usage:

If you have downloaded and stored the libary into \Include folder ([path to your MetaTrader 4]\MQL4\Include), you are able to include it like this:

#include <BinaryOptionsStrategyLibrary.mqh>
The library will be available like described in the example above if it is placed in \Include folder of your MetaTrader 4.
Changing the content of the library is not needed! 


Provided input parameters:

The library provides the following input parameters to use in your indicator which contains your Binary Options strategy:

//—- Input parameters
input YesNo oneTradePerCandle                   = YES;      //Just one SELL/BUY Trade per candle
input YesNo shouldCheckOnlyAtBeginningOfCandle  = YES;      //Check only at beginning of new candles (not on every tick)

Binary Options Strategy Library Input Parameters

 

Binary Options Strategy Library Input Parameters

 


Provided functions:

The library provides the following functions to use in your indicator which contains your Binary Options strategy.

PlaceTrade()

Place a trade (OP_SELL or OP_BUY) in Binary-Options-Strategy-Tester. 

//+——————————————————————+
//| Function to place orders for Strategy-Tester.                    |
//| Input parameter: OP_SELL or OP_BUY                               |
//+——————————————————————+
void PlaceTrade(
   int _tradeOperation //Trade operation OP_SELL or OP_BUY
   );

Parameters:

  _tradeOperation – [in] Trade operation type. It can be OP_SELL or OP_BUY of Trade operation enumeration.

Return value:

  No return value.

PrintDebugValue()

Prints out debug values while Binary-Options-Strategy-Tester is running.

//+——————————————————————+
//| Function to print out debug-values                               |
//+——————————————————————+
void PrintDebugValue(
   string _labelText=“”, //Text for the label
   string _valueText=“”, //Value to print out
   int    _row=0         //Row of the message, starting with 0
   );

Parameters:

  _labelText – [in] Text of the label.

  _valueText – [in] Value to print out.

  _row – [in] Row of the message, starting with 0. 

Alternative:  Graphic Panel Contest - EA MetaTrader 5

Return value:

  No return value.

CallStrategy()

Function will decide if tester has to check for the strategy rules. Call this function in OnCalculate event of your indicator which contains your Binary Options strategy.

//+——————————————————————+
//| Function to decide if we have to check for our rules or not.     |
//| Call this function in OnCalculate-event of your indicator.       |
//+——————————————————————+
void CallStrategy();

Parameters:

  No parameters.

Return value:

  No return value.

Note:

CallStrategy() function in the library will call a function named CheckMyRules() in your indicator where you have to place your conditions of your Binary Option strategy.
Therefore you have to implement the function CheckMyRules() in your Binary Options strategy indicator.


Example:

See “How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester” for an example how to use this library and implement CheckMyRules() in combination with Binary Options Strategy Tester utility from marketplace.


FAQ:

  • Question: I can not compile the library without errors. What is going wrong?
  • Answer: You do not need to compile the library (this mqh file). It will be included in your Binary Options strategy.
  • Question: Why you did not show a complete example how to use the library on this page to go the next steps?
  • Answer: A complete example is shown in the article “How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester”.
  • Question: Do I need to rent the Binary-Options-Strategy Tester in Marketplace to test and improve my Binary Options strategies?
  • Answer: Yes. To use the utility “Binary-Options-Strategy Tester” from Marketplace you have to rent it.
  • Question: I got errors like “Cannot call .. BinaryOptionsStrategyTester.ex4::PrintDebugValue” or “Cannot load .. \Experts\Market\BinaryOptionsStrategyTester.ex4” in the log of MetaTrader 4. What can I do?
  • Answer: Make sure to use the latest version (greater than v1.00) of the library. Check the version tag in code of your library and see changelog v1.01 for more information.


Further informations:

  • Binary Options Strategy Tester — Binary Options Test Framework utility from marketplace to test and improve your Binary Options strategy with Strategy Tester of MetaTrader 4.
  • How to build and test a Binary Options strategy with the MetaTrader 4 Strategy Tester — Article with an example of a Binary Options strategy stored in an indicator to use with Binary-Options-Strategy-Tester.
Alternative:  Trendlines and Horizontal lines crossing notification EA - EA MetaTrader 5


Changelog:

v1.01

  • Fixed “Cannot load..” and “Cannot call..” errors by changing the import filename from “..\\Experts\\Market\\BinaryOptionsStrategyTester.ex4” to “..\\Experts\\Market\\Binary Options Strategy Tester.ex4”. Filename of Binary Options Strategy Tester from Marketplace is “Binary Options Strategy Tester.ex4” instead of assumed “BinaryOptionsStrategyTester.ex4”. Therefore the import of the file did not match the correct filename of Binary Options Strategy Tester utility which causes in errors like “Cannot call .. BinaryOptionsStrategyTester.ex4::PrintDebugValue” or “Cannot load .. \Experts\Market\BinaryOptionsStrategyTester.ex4”.
📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks