Doubt with iCustom

 

Hi, 

I am a new member in this web. I am learning to programm on mql4. First i create two indicators:

- create arrows with values of fractal down

- create arrows with values of fractal up.

 

Now, i want connect this two indicator with other indicator wit the function "icustom".

I have this for learning to programm, this indicators not use for trade.

 

The problem is that my last indicator give me arrows in every candles:

 

 

My two indicators that give me fractals arrows are:

1-fractalsUp

2-fractalsDown.

The extern setting in this two indicators are:

-Equals

-nLeftUp

-nRightUp

-nLeftDown

-nRightDown.

 

and mi code of the las indicator is:

//+------------------------------------------------------------------+
//|                                                       test.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Red
//---- input parameters
extern int       Equals=5;
extern int       nLeftUp=2;
extern int       nRightUp=2;
extern int       nLeftDown=2;
extern int       nRightDown=2;

//---- buffers
double fractalsUp[];
double fractalsDown[];

//+------------------------------------------------------------------+
//| Custom indicator initialization functi                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,fractalsUp);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,fractalsDown);
   SetIndexEmptyValue(1,0.0);
    return(0);
  }
  
  //+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
  int counted_bars=IndicatorCounted();


if (counted_bars>0)
counted_bars--;
int limit= Bars-counted_bars;


for (int i=0;i<limit;i++)
{

fractalsUp[i]=iCustom(NULL,0,"fractalsUp",Equals,nLeftUp,nRightUp,nLeftDown,nRightDown,0,i);
fractalsDown[i]=iCustom(NULL,0,"fractalsDown",Equals,nLeftUp,nRightUp,nLeftDown,nRightDown,1,i);
}
return(0);
} 
   

 

 I would like that you help me to learn to programm. 

Thank you very much.

 

1) I don't see any arrow in your chart.

2) check the SetEmptyValues of all the three indicators.

 

Hi gooly,

The other two indicators run good.

The arrows are on the bottom of chart, on top of date and hours.

The others two indicator run good and i think the mistake is in this code.

Thank you very much for your reply 

 

Everyone have a solution.

Thank you very much. 

 

i want to ask how can i have fractals of m15 for example in m5(current timeframe)?. Is possible?. I was search but i am a little confused.

 

Hi . Any solution?. I still did not find a solution.

Thank you very much 

 
google for mtf = multi time frame and fractals
 
I already searched but I get lost a little. 
I looked at many indicators but I have many doubts. 
For example, I created fractals with iCustom. 
But if I created fractals of m15 in current timeframe (m5) then i do not know how I can do. 
ObjectCreate? 
itime using? ... 
I'm a little lost.
 

Learn to walk before you try to run.

If you are lost, concentrate on simpler code and build your education. 

Reason: