Hallo
I am using "day HL" indicator which displays (as two lines) yesterday's high and low on today's chart.
Is this possible to delete this lines (for more clarity of the chart) and change foreground colour beetwen them?
This is formula of "dayHL" indicator.
Thanks for help
Iwan
//+------------------------------------------------------------------+
//| dayHL_Average.mq4 |
//+------------------------------------------------------------------+
/*
Name := dayHL_Average
Author := KCBT
Link :=
http://www.kcbt.ru/forum/index.php?
*/
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color3 Red
//---- input parameters5
extern int show_comment=1; // comments on the chart (0 - no, 1 - yes)
extern int how_long=1000; // bars to be counted (-1 - all the bars)
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(2, DRAW_LINE);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
return(0);
}
int start()
{
int cnt=0; // ń÷ĺň÷čę áŕđîâ
int begin_bar=0; // áŕđ, ń ęîňîđîăî íŕ÷číŕĺň đŕáîňó číäčęŕňîđ
int prev_day, cur_day; // čäĺíňčôčęŕňîđű ňĺęóůĺăî č ďđĺäűäóůĺăî äí˙
double day_high=0; // äíĺâíîé high
double day_low=0; // äíĺâíîé low
double yesterday_high=0; // íŕčáîëüřŕ˙ öĺíŕ ďđĺäűäóůĺăî äí˙
double yesterday_low=0; // íŕčěĺíüřŕ˙ öĺíŕ ďđĺäűäóůĺăî äí˙
double yesterday_close=0; // öĺíŕ çŕęđűňč˙ ďđĺäűäóůĺăî äí˙
double P, S, R;
// ďđŕâčëüíűĺ ňŕéěôđĺěű äë˙ íŕřĺăî číäčęŕňîđŕ - âńĺ, ÷ňî ěĺíüřĺ D1
if (Period() >= PERIOD_D1) {
Comment("WARNING: Invalid timeframe! Valid value < D1.");
return(0);
}
// đĺřŕĺě ń ęŕęîăî áŕđŕ ěű íŕ÷íĺě ń÷čňŕňü íŕř číäčęŕňîđ
if (how_long == -1) {
begin_bar = Bars;
} else {
begin_bar = how_long;
}
// îáőîäčě áŕđű ńëĺâŕ íŕďđŕâî (0-é áŕđ ňîćĺ čńďîëüçóĺě, ň.ę. čç íĺăî ěű áĺđ¸ě ňîëüęî high č low)
for (cnt = begin_bar; cnt >= 0; cnt--) {
cur_day = TimeDay(Time[cnt]);
if (prev_day != cur_day) {
yesterday_close = Close[cnt+1];
yesterday_high = day_high;
yesterday_low = day_low;
P = (yesterday_high + yesterday_low ) / 2;
R = yesterday_high;
S = yesterday_low;
// ň.ę. íŕ÷ŕëń˙ íîâűé äĺíü, ňî číčöččđóĺě ěŕęń. č ěčí. ňĺęóůĺăî (óćĺ) äí˙
day_high = High[cnt];
day_low = Low[cnt];
// çŕďîěíčě äŕííűé äĺíü, ęŕę ňĺęóůčé
prev_day = cur_day;
}
// ďđîäîëćŕĺě íŕęŕďëčâŕňü äŕííűĺ
day_high = MathMax(day_high, High[cnt]);
day_low = MathMin(day_low, Low[cnt]);
// đčńóĺě pivot-ëčíčţ ďî çíŕ÷ĺíčţ, âű÷čńëĺííîěó ďî ďŕđŕěĺňđŕě â÷ĺđŕříĺăî äí˙
ExtMapBuffer2[cnt] = P;
// đčńóĺě ëčíčč ńîďđîňčâëĺíč˙ č ďîääĺđćęč óđîâí˙ 1,2 čëč 3
ExtMapBuffer1[cnt] = R; // ńîďđîňčâëĺíčĺ
ExtMapBuffer3[cnt] = S; // ďîääĺđćęŕ
}
if (show_comment == 1) {
P = (yesterday_high + yesterday_low ) / 2;
R = yesterday_high;
S = yesterday_low;
Comment("Current H=", R, ", L=", S, ", HL/2=", P, ", H-L=", (R-S)/Point );
}
return(0);
}
//+------------------------------------------------------------------+