Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Expert Advisor | e-Regr

Trading by i-Regr (Regression Channel):

MetaTrader Experts, Indicators, Scripts and Libraries

MetaTrader Experts, Indicators, Scripts and Libraries 

Regression Channel: Linear Regression Channel, Quadratic (Parabolic) Regression Channel, Cubic Regression Channel.

Implemented the trend protection: if a previous day's D1 exceeds 1500 pips ("protection size D1 bar" input) – disable trading and close all open positions.

Test period: 2016.01.01 — 2016.10.26, initial deposit — 10 000, timeframe — H1:

MetaTrader Experts, Indicators, Scripts and Libraries 

In the below code, it is already assumed that i-Regr indicator is already in the \MQL5\Indicators\ folder:

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   m_symbol.Name(Symbol());                  // sets symbol name
   m_trade.SetExpertMagicNumber(m_magic);    // sets magic number
//--- create handle of the indicator i-Regr
   handle_i_Regr=iCustom(Symbol(),Period(),"i-Regr",
                         Regr_kstd,
                         Regr_degree,
                         Regr_bars,
                         Regr_shift
                         );
//--- if the handle is not created
   if(handle_i_Regr==INVALID_HANDLE)
16709

Best MetaTrader Indicators + Profitable Expert Advisors