Author of the idea βΒ Hazem, author of the MQL5 code βΒ barabashkakvn.
The main difficulty of the code is comparing iCCI and iMACD values with the “Buy Sell Level” variable. The indicator values may be different several or even dozens of times.Β
For example, for EURUSD, USDJPY and USDSEK symbols as well as for all period values available in MetaTrader 5:
Β
Β
Β
As you can see, iCCI is stable enough in its readings, while iMACD is highly dependent on the symbol price. To solve that, we may multiply iMACD values by a ratio:
void OnTick()
Β Β {
//—-
Β Β m_ext_lot=NormalizeDouble(m_account.Balance()/50001.0,2);
Β Β if(m_ext_lot<0.1)
Β Β Β Β Β Β m_ext_lot=0.1;
Β Β m_cci=iCCIGet(0);
Β Β m_macd=iMACDGet(MAIN_LINE,0)*1000000;
Β Β m_buy_total=0;
Β Β m_sell_total=0;
Β Β {
//—-
Β Β m_ext_lot=NormalizeDouble(m_account.Balance()/50001.0,2);
Β Β if(m_ext_lot<0.1)
Β Β Β Β Β Β m_ext_lot=0.1;
Β Β m_cci=iCCIGet(0);
Β Β m_macd=iMACDGet(MAIN_LINE,0)*1000000;
Β Β m_buy_total=0;
Β Β m_sell_total=0;
Tip: EURUSD M30 is recommended.
Results from 2016.01.08 to 2016.11.06, EURUSD M30, initial deposit β 10 000:
Β
Β