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:
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 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)
Â
Â
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.Â
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:
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.
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”.