help with a mt4 indicators strategy

 

hello so i don't know about coding or mql4 language that's why i use eabuilder it's a visual interface for making indicators. 

i'm trying to build a strategy here for binary options it consits in these indicators:

CCI 2 66 -66
MONEY FLOW INDEX 100-0
TREND INTENSITY INDEX 24 PERIOD ABOVE/BELOW 50

rules are simple when cci is -66 and mfi is 0 and tii is above 50 level all at the same time then an arrow should appear in the next candle for a buy 

 when cci is 66 and mfi is 100 and tii is below 50 level all at the same time then an arrow should appear in the next candle for a sell



so what i can make in that visual interface is something like the picture i attach the problem is that i can't make the sell options to work right idk whats the problem also i can't make it work with the condition of the TII (trend directional index) 

could you guys help me to make this right? i attach the code as well 

//+------------------------------------------------------------------+
//|                                                        Indicator |
//|                                       Created with EABuilder.com |
//|                                             http://eabuilder.com |
//+------------------------------------------------------------------+
#property copyright "Created with EABuilder.com"
#property link      "http://eabuilder.com"
#property version   "1.00"
#property description ""

#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 2

#property indicator_type1 DRAW_ARROW
#property indicator_width1 1
#property indicator_color1 0xFFAA00
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 1
#property indicator_color2 0x0000FF
#property indicator_label2 "Sell"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | heroes del trading v2 @ "+Symbol()+","+Period()+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 241);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   SetIndexArrow(1, 242);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      //Indicator Buffer 1
      if(iMFI(NULL, PERIOD_CURRENT, 2, i) == 0 //Money Flow Index is equal to fixed value
      && iCCI(NULL, PERIOD_CURRENT, 2, PRICE_TYPICAL, i) <= -66 //Commodity Channel Index <= fixed value
      && iCustom(NULL, PERIOD_CURRENT, "Trend Intensity Index", 24, PRICE_CLOSE, 80, 20, 0, i) >= 50 //Trend Intensity Index >= fixed value
      )
        {
         Buffer1[i] = Low[i] - 2; //Set indicator value at Candlestick Low - fixed value
        }
      else
        {
         Buffer1[i] = 0;
        }
      //Indicator Buffer 2
      if(iMFI(NULL, PERIOD_CURRENT, 2, i) == 100 //Money Flow Index is equal to fixed value
      && iCCI(NULL, PERIOD_CURRENT, 2, PRICE_TYPICAL, i) >= 66 //Commodity Channel Index >= fixed value
      && iCustom(NULL, PERIOD_CURRENT, "Trend Intensity Index", 24, PRICE_CLOSE, 80, 20, 0, i) <= 50 //Trend Intensity Index <= fixed value
      )
        {
         Buffer2[i] = High[i] + 2; //Set indicator value at Candlestick High + fixed value
        }
      else
        {
         Buffer2[i] = 0;
        }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
Files:
indicator.png  133 kb
 
This indicator generates a Buy signal only when MFI is equal to 0 and a Sell only if it equals 100. Which is almost always not the case.
 
lippmaje:
This indicator generates a Buy signal only when MFI is equal to 0 and a Sell only if it equals 100. Which is almost always not the case.
They mfi Is in 2 periods 
 
albert-94:
They mfi Is in 2 periods 
MFI is an oscillator and so ranges between 0 .. 100. Your indicator triggers only on 0 and 100. I think you meant something like MSI<=20 and >=80, check it.
 

Perhaps you are mistaking the usage of "iCustom". Fix it as follows and try it.

iCustom(NULL, PERIOD_CURRENT, "Trend Intensity Index", 0, i) >= 50

iCustom(NULL, PERIOD_CURRENT, "Trend Intensity Index", 0, i) <= 50