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:
synergy_apbg2.mq4
3 kb
- Coding questions ...
- How to increase and reduce the size of text when chart zoom in and out?
- New metatrader 4 compatible indicators
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
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();
}
}
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register