BatFink Daily High-Low

Download script
BatFink Daily High-Low

This indicator is designed to provide traders with a clear visual representation of historical price boundaries based on daily highs and lows. By analyzing previous trading sessions, it automatically identifies key structural levels—specifically the "Resistance" (the highest price reached) and the "Support" (the lowest price reached)—and plots them onto your current chart.

Core Functionality

The script scans through historical price data to track the highest and lowest points of every individual day. When a new day begins, the indicator captures the boundaries of the previous day and carries them forward into the current session. This allows you to see exactly where the market "ceiling" and "floor" were established in the prior period.

Key Features

  • Dynamic Support and Resistance: The tool automatically identifies and draws lines for the daily high and daily low. These serve as significant psychological levels where price action often reacts, reverses, or consolidates.
  • Historical Depth: You can customize how far back into the past the indicator should look. You can set it to analyze a specific number of previous bars or choose to load the entire available history of the chart.
  • Visual Clarity: The data is rendered as dotted lines on your chart, ensuring that while the levels are clearly visible for analysis, they do not clutter your workspace.
  • On-Screen Statistics: Optionally, the script can display a real-time text comment on your chart. This provides an instant summary of three key values:
    1. The High (Resistance)
    2. The Low (Support)
    3. The Midpoint (the exact halfway point between the high and low)
    4. The Total Range (the distance between the high and low in points)

How it Benefits Your Trading

Instead of manually calculating where yesterday's price extremes were, this script automates that process. It allows you to quickly identify "Value Areas" and understand the volatility of previous sessions. By visualizing these boundaries, you can better anticipate potential breakouts or pullbacks based on established historical data.

Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
BatFink Daily High-Low
/*------------------------------------------------------------------+
//| dayHL_Average.mq4 |
//+------------------------------------------------------------------+
/*

*/

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color3 Blue

//---- input parameters5
extern int show_comment=0; // comments on the chart (0 - no, 1 - yes)
extern int how_long=10000; // 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, STYLE_DOT);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(2, DRAW_LINE, STYLE_DOT);
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; 
double day_low=0; 
double yesterday_high=0; 
double yesterday_low=0; 
double yesterday_close=0; 
double P, S, R;

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;
}

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]);

// 
//ExtMapBuffer2[cnt] = P;

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);
}
//+------------------------------------------------------------------+

Comments