Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2016.12.22 14:38
Libraries

Binary Options Strategy Library - library for MetaTrader 4

| English Español Português 日本語 Deutsch

Views:
2909
Rating:
votes: 7
\MQL4\Include\

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. 

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: 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:


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".
Custom Moving Average Indicator Custom Moving Average Indicator

Code based on MetaTrader 4 Moving Average indicator.

Ichimoku Kinko Hyo System Ichimoku Kinko Hyo System

An EA fully based on the Ichimoku Kinko Hyo system.

LB & SB using RSI & Momentum LB & SB using RSI & Momentum

The same EA's as previously released. The additional code allows the user to set parameters on RSI and Momentum.

Ultimate Moving Average Ultimate Moving Average

Moving Average based on Ultimate Oscillator. It calculates weighted average of three moving averages (Simple, Exponential, Smoothed or Linear Weighted).