Implement 2 MA Cross with CCI filter

 

Hello MQL5 Community,

I am currently developing an EA and would like your assistance in implementing 2 MA Cross and CCI Filter conditions to confirm entry as either OP BUY or OP SELL market conditions.

I'd like to have a choice for both conditions before using them as "True or False." The idea is to have a choice when using these conditions, such as: Set CCI Filter to "true," where MA cross will collaborate with CCI to confirm entry.

I'd like to base my entry confirmation on the CCI code provided below. I am also making use of a timed entry of "if(Hour() == StartHour)".

// 2 MA Cross Conditions
extern int     SlowMA_Period            = 50;
extern int     SlowMA_Time              = 0;
input ENUM_MA_METHOD SlowMA_Method      = MODE_EMA;
input int      SlowMA_Shift             = 0;
input ENUM_APPLIED_PRICE SlowMA_Price   = PRICE_CLOSE;
input ENUM_TIMEFRAMES SlowChart_Period  = NULL;

extern int     FastMA_Period            = 50;
extern int     FastMA_Time              = 0;
input ENUM_MA_METHOD FastMA_Method      = MODE_EMA;
input int      FastMA_Shift             = 0;
input ENUM_APPLIED_PRICE FastMA_Price   = PRICE_CLOSE;
input ENUM_TIMEFRAMES FastChart_Period  = NULL;

// Global Variables
double
FastMACurrent,
FastMAPrevious,
SlowMACurrent,
SlowMAPrevious;


// Indicator Call 

int Current = 0;

FastMACurrent = iMA(Symbol(), FastMA_Time, FastMA_Period, FastMA_Shift, FastMA_Method, FastMA_Price, Current + 0);

FastMAPrevious = iMA(Symbol(), FastMA_Time, FastMA_Period, FastMA_Shift, FastMA_Method, FastMA_Price, Current + 1);

SlowMACurrent = iMA(Symbol(), SlowMA_Time, SlowMA_Period, SlowMA_Shift, SlowMA_Method, SlowMA_Price, Current + 0);

SlowMAPrevious = iMA(Symbol(), SlowMA_Time, SlowMA_Period, SlowMA_Shift, SlowMA_Method, SlowMA_Price, Current + 1);


// Entry Condition

if(Hour() == StartHour)
     {
      comment = GetDateAndTime();
      if(OpenBar == true)
        {
         OpenBar = false;
         if(iVolume(NULL,0,0)>1) OpenBar=false;


            //FindTicket makes sure that the EA will pick up its orders
            //even if it is relaunched
            ticket = FindTicket(Magic);

         bool res;
         res = OrderSelect(ticket, SELECT_BY_POS,MODE_TRADES);
         if(res == true)
           {
            if(OrderCloseTime() == 0)

              {
               bool res2;
               res2 = OrderClose(ticket, Lots, OrderClosePrice(), 10);

               if(res2 == false)
                 {
                  Alert("Error Closing Order #", ticket);
                 }
              }
           }

         if(Open[0] < Open[StartHour] - MinPipLimit*vPoint) //v3.0
           {
            // && All Conditions True
            // || 1 Condition True

            //check ma with option to set as true or false in global variables//

            if(Close[0] && Ask > FastMACurrent > SlowMACurrent && FastMAPrevious < SlowMAPrevious && OpenBar || MAFilter == false && CCIFilter == false)
              {
            ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, vSlippage, Bid-StopLoss*vPoint, Bid+TakeProfit*vPoint, "Set by Process Expert Advisor", Magic,0,Blue);
            if(ticket < 1)


// CCI Condition check
CCI1 = iCCI(Symbol(),_Period,50,PRICE_TYPICAL,0);
CCI2 = iCCI(Symbol(),_Period,50,PRICE_TYPICAL,1);
  
  
if(CCI1 >-100 && CCI2 <=-100) return _Sell;
if(CCI1 <100 && CCI2 >=100) return _Buy;

Your support with this project is highly appreciated.

 
OTMT Howard:

Hello MQL5 Community,

I am currently developing an EA and would like your assistance in implementing 2 MA Cross and CCI Filter conditions to confirm entry as either OP BUY or OP SELL market conditions.

I'd like to have a choice for both conditions before using them as "True or False." The idea is to have a choice when using these conditions, such as: Set CCI Filter to "true," where MA cross will collaborate with CCI to confirm entry.

I'd like to base my entry confirmation on the CCI code provided below. I am also making use of a timed entry of "if(Hour() == StartHour)".

Your support with this project is highly appreciated.

For contributions to projects like this one, it's "convention" to hire a freelancer which you can do from here. However, as you have done a good chunk of the groundwork already, plus your code is well formatted,  it shouldn't take up much of a freelancer's time, so you shouldn't need to pay much. 

 
TheHonestPrussian #:

For contributions to projects like this one, it's "convention" to hire a freelancer which you can do from here. However, as you have done a good chunk of the groundwork already, plus your code is well formatted,  it shouldn't take up much of a freelancer's time, so you shouldn't need to pay much. 

Hei,


Thank you for the information and your honesty. Do you perhaps know anyone that might be a good match for this type of project. Perhaps anyone you know.

Regards,

Reason: