Change Candle Size automatically when zooming in or out



- Coding questions ...
- How to increase and reduce the size of text when chart zoom in and out?
- New metatrader 4 compatible indicators
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();
#property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 3 #property indicator_width4 3
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.
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();
}
}