Change Candle Size automatically when zooming in or out

 
Hi

Is it possible to automatically change the Candle Size when i zoom out or zoom in?

When i zoom out for example, the candles are getting into each other, which looks like a mess (third Picture)

I am using Heiken Ashi Candles, mq4 File is attached. I think i need to write something like: If zoom 2x, then candle width 4..... 

But i dont know how to do that. Help, please :)

Thank You!
















Files:
 
maccaroni:I think i need to write something like: If zoom 2x, then candle width 4..... 

But i dont know how to do that.
int width=0;
int OnInit(){
   width = (int)   ChartGetInteger(0,CHART_SCALE);
   SetIndexBuffer(0,abHigh); ... SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, width);
   :
   return   INIT_SUCCEEDED;
}
int OnCalculate(...){
   if(ChartGetInteger(0,CHART_SCALE) != width)  OnInit();
 
Thanks, but i still dont know how to implemet that into the indicator, i have virtually no coding knowledge.

Can you explain it? Or maybe its easier to copy the code into the mq4 file, this is the Width that i want to change at the beginning of the File:



#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 3
#property indicator_width4 3

 

If you use the width property it is fixed. Remove them.

If you use the function call (I showed) it can be varied. Add the code.

learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

 

   Put this n int OnCalculate '

int w;

int a = 1;

   w = (int) ChartGetInteger(0,CHART_SCALE);

   if (w == 5)

   a = 11;

   if (w == 4)

   a = 7;

   if (w == 3)

   a = 3;

   if (w == 2)

   a = 1;

   SetIndexStyle(2,DRAW_HISTOGRAM,0,a,ExtColor3);

   SetIndexStyle(3,DRAW_HISTOGRAM,0,a,ExtColor4);


This will resize the HA candles on the fly.

 
int GetBarWidth(int MyScale)
{
   switch(MyScale)
   {
   case 0:
   case 1:
   case 2:return(2);
   case 3:return(3);
   case 4:return(6);
   case 5:return(13);
   default:return(2);
   }
}


void OnChartEvent(const int id,

                  const long &lparam,

                  const double &dparam,

                  const string &sparam)

{

if(id==CHARTEVENT_CHART_CHANGE)

{

 int w=GetBarWidth((int)ChartGetInteger(0,CHART_SCALE));   

SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,w,ExtColor3);

SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,w,ExtColor4);

ChartRedraw();

}

}

Reason: