iCustom Help - Heiken_Ashi.ex5 [2] open error

 

I keep getting open error for iCustom.

Heiken_Ashi.ex5 is in indicator folder.

I think I have messed up the handle. Here is handle and heiken_ashi indicator code. There arent any other handle parameters I need are there? Heiken Ashi just changes the candlesticks with a bit of math. There are no parameters needed when you load the indicator except the colour.

 

HA.Init(_Symbol,_Period,"Heiken_Ashi"); //initiation handle, this is connected to an include file with other indicators thats why its HA.init instead of iCustom(_Symbol,_Period,"Heiken_Ashi")


 HeikenAshi


//+------------------------------------------------------------------+
//|                                                  Heiken_Ashi.mq5 |
//|                        Copyright 2009, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_plots   1
#property indicator_type1   DRAW_COLOR_CANDLES
#property indicator_color1  DodgerBlue, Red
#property indicator_label1  "Heiken Ashi Open;Heiken Ashi High;Heiken Ashi Low;Heiken Ashi Close"
//--- indicator buffers
double ExtOBuffer[];
double ExtHBuffer[];
double ExtLBuffer[];
double ExtCBuffer[];
double ExtColorBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA);
   SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA);
   SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA);
   SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX);
//---
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- sets first bar from what index will be drawn
   IndicatorSetString(INDICATOR_SHORTNAME,"Heiken Ashi");
//--- sets drawing line empty value
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
//--- initialization done
  }
//+------------------------------------------------------------------+
//| Heiken Ashi                                                      |
//+------------------------------------------------------------------+
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 i,limit;
//--- preliminary calculations
   if(prev_calculated==0)
     {
      //--- set first candle
      ExtLBuffer[0]=low[0];
      ExtHBuffer[0]=high[0];
      ExtOBuffer[0]=open[0];
      ExtCBuffer[0]=close[0];
      limit=1;
     }
   else limit=prev_calculated-1;

//--- the main loop of calculations
   for(i=limit;i<rates_total && !IsStopped();i++)
     {
      double haOpen=(ExtOBuffer[i-1]+ExtCBuffer[i-1])/2;
      double haClose=(open[i]+high[i]+low[i]+close[i])/4;
      double haHigh=MathMax(high[i],MathMax(haOpen,haClose));
      double haLow=MathMin(low[i],MathMin(haOpen,haClose));

      ExtLBuffer[i]=haLow;
      ExtHBuffer[i]=haHigh;
      ExtOBuffer[i]=haOpen;
      ExtCBuffer[i]=haClose;

      //--- set candle color
      if(haOpen<haClose) ExtColorBuffer[i]=0.0; // set color DodgerBlue
      else               ExtColorBuffer[i]=1.0; // set color Red
     }
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
HA.Init(_Symbol,PERIOD_CURRENT,"Heiken_Ashi");
 
Muzaffar Ergashaliev:
HA.Init(_Symbol,PERIOD_CURRENT,"Heiken_Ashi");
still has open error
 
Reilly Gailey:

I keep getting open error for iCustom.

Heiken_Ashi.ex5 is in indicator folder.

I think I have messed up the handle. Here is handle and heiken_ashi indicator code. There arent any other handle parameters I need are there? Heiken Ashi just changes the candlesticks with a bit of math. There are no parameters needed when you load the indicator except the colour.

 

HA.Init(_Symbol,_Period,"Heiken_Ashi"); //initiation handle, this is connected to an include file with other indicators thats why its HA.init instead of iCustom(_Symbol,_Period,"Heiken_Ashi")


 HeikenAshi


Check the indicator folder, may Heiken Ashi.ex5 have become two files, immediately removed Heiken Ashi.ex5 [2] file
 
Roberto Jacobs:
Check the indicator folder, may Heiken Ashi.ex5 have become two files, immediately removed Heiken Ashi.ex5 [2] file

Hi, thanks for reply

Nah there is only one. to be sure I renamed the indicator to Heiken_Ashi1 and it still came up with same opoen error [2] 

 

Here is code that handles the indicator this is part of the include file

 

//+------------------------------------------------------------------+
//|           Heiken Ashi                                            |
//+------------------------------------------------------------------+


class CiHeikenAshi : public CIndicator
{
        private:
                double hopen[];
                double hclose[];
                double hhigh[];
                double hlow[];
                
        public:
                int Init(string pSymbol,ENUM_TIMEFRAMES pTimeframe,string Indicator_Name);
                double Hopen(int pShift=0);
                double Hclose(int pShift=0);
                double Hhigh(int pShift=0);
                double Hlow(int pShift=0);
                CiHeikenAshi();
};


CiHeikenAshi::CiHeikenAshi()
{
        ArraySetAsSeries(hopen,true);
        ArraySetAsSeries(hclose,true);
                ArraySetAsSeries(hhigh,true);
        ArraySetAsSeries(hlow,true);
}


int CiHeikenAshi::Init(string pSymbol,ENUM_TIMEFRAMES pTimeframe,string Indicator_Name)
{
        handle = iCustom(pSymbol,pTimeframe,Indicator_Name);
        return(handle);
}


double CiHeikenAshi::Hopen(int pShift=0)
{
        CopyBuffer(handle,0,0,MAX_COUNT,hopen);
        double value = NormalizeDouble(hopen[pShift],_Digits);
        return(value);
}


double CiHeikenAshi::Hclose(int pShift=0)
{
        CopyBuffer(handle,3,0,MAX_COUNT,hclose);
        double value = NormalizeDouble(hclose[pShift],_Digits);
        return(value);
}

double CiHeikenAshi::Hlow(int pShift=0)
{
        CopyBuffer(handle,2,0,MAX_COUNT,hlow);
        double value = NormalizeDouble(hlow[pShift],_Digits);
        return(value);
}


double CiHeikenAshi::Hhigh(int pShift=0)
{
        CopyBuffer(handle,1,0,MAX_COUNT,hhigh);
        double value = NormalizeDouble(hhigh[pShift],_Digits);
        return(value);
}
 

Even when I call like this its the same error, im pretty sure its incorrect handle but how do i find out the correct handle?

int Initiation = iCustom(_Symbol,PERIOD_CURRENT,"Heiken_Ashi");
 
Reilly Gailey:

Even when I call like this its the same error, im pretty sure its incorrect handle but how do i find out the correct handle?

int Initiation = iCustom(_Symbol,PERIOD_CURRENT,"Examples\\Heiken Ashi.ex5");
you may need to add a directory path: Examples\\"Heiken Ashi.ex5"

 

It will not work without .ex5 in the data path.

And print the error to see the error code it will tell you what is.

 
Marco vd Heijden:

It will not work without .ex5 in the data path.

And print the error to see the error code it will tell you what is.

thanks guys yea it was a directory error. works now cheers!