Experts: CCI and Martin

 

CCI and Martin:

The EA based on iCCI (Commodity Channel Index, CCI) indicator plus managing position volumes using martingale.

The EA uses iCCI (Commodity Channel Index, CCI) indicator value on the last four bars and Open/Close prices on the last three bars. A position opening signal is checked if less than 20 seconds remain before closing the current bar (this is a very rare solution) and if there are no positions opened by this EA.

Position opening conditions

//--- BUY
   if(cci[1]<5 && cci[2]<cci[3] && cci[1]<cci[2] && cci[0]>cci[1] && 
      Open[2]>Close[2] && Open[1]>Close[1] && Open[0]<Close[0] && Open[1]<Close[0])

//--- SELL
   if(cci[1]>-5 && cci[2]>cci[3] && cci[1]>cci[2] && cci[0]<cci[1] && 
      Open[2]<Close[2] && Open[1]<Close[1] && Open[0]>Close[0] && Open[1]>Close[0])

where:

  • cci[] - array of CCI indicator values;
  • Open[] and Close[] - open and close prices arrays, respectively.

Author: Vladimir Karputov

 
In this case, the signal to open a position is checked if there are less than 20 seconds left before the current bar is closed (I should note that this solution is very rare)
Where can I see it in the code?
 
Igor Nistor:
Where can I see this in the code?

Here's where the number of seconds is determined:

//+------------------------------------------------------------------+
//| Expert tick function|
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if(!IsPositionExists())
     {
      MqlDateTime STimeCurrent;
      TimeToStruct(TimeCurrent(),STimeCurrent);
      if(STimeCurrent.sec<40)
         return;
      //---
      double cci[];
      ArraySetAsSeries(cci,true);
      MqlRates rates[];
      ArraySetAsSeries(rates,true);
...

If the seconds are less than 40, we just exit.


This change is included in version 1.002 (need to wait for republishing).

 
Thank you!
 

Dear Vladimir Karputov and Barabashkakvn,

First of all, I'd like to thank to both of you for sharing your EA.

I wold like to ask about the Input Parameter "Inp_ma_period" and "Inp_applied_price".

Does this mean that your EA use Moving Average too ?

Thank You.

 
TraderFX Bandung :

Dear Vladimir Karputov and Barabashkakvn,

First of all, I'd like to thank to both of you for sharing your EA.

I wold like to ask about the Input Parameter "Inp_ma_period" and "Inp_applied_price".

Does this mean that your EA use Moving Average too ?

Thank You.

No. This Expert Advisor does not use the Moving Average indicator. This EA uses the iCCI indicator.

For notation - see the iCCI help :

int  iCCI( 
   string              symbol,            // symbol name 
   ENUM_TIMEFRAMES     period,            // period 
   int                 ma_period,         // averaging period 
   ENUM_APPLIED_PRICE  applied_price      // type of price or handle 
   );
 

Forum on trading, automated trading systems and testing trading strategies

Experts: CCI and Martin

Victor Volovin, 2018.12.09 19:15

Hi. I have set the possible number of positions of increasing volume in a row equal to 1 . The Expert Advisor increases three times.



What can be the reason?


 
Postponed: https://www.mql5.com/ru/forum/266389#comment_9821442
Советники: CCI and Martin
Советники: CCI and Martin
  • 2018.07.18
  • www.mql5.com
CCI and Martin: Автор: Vladimir Karputov...
 
 
Victor Volovin:

So maybe you should switch on the "Use martingale" block to make it work?

 
Vladimir Karputov:

So maybe we should switch on the "Use martingale" block to make it work?

The screenshot shows that martingale is disabled.