KiS_Avg_v1

This tool is designed to provide a clear visual and numerical summary of the price action occurring within each trading day. Rather than focusing on complex momentum oscillators, it simplifies market behavior by identifying the extreme boundaries of price movement—specifically the highest and lowest points reached during a single day.

How the Logic Works

The script operates by scanning through historical price data and organizing it into daily "buckets." Here is the step-by-step logic:

1. Daily Boundary Identification For every trading day, the script identifies two primary values:

  • The High: The maximum price reached during that specific day.
  • The Low: The minimum price reached during that specific day.

2. Calculating the Midpoint (Average) Once the high and low are established, the script calculates the mathematical average (the midpoint) of that day's range. This represents the "center" of the daily price action.

3. Visual Representation The script plots these values onto your chart using three distinct lines:

  • One line tracks the Daily High.
  • One line tracks the Daily Low.
  • A third line tracks the Daily Average (Midpoint).

By looking at these lines, you can instantly see the "corridor" in which the price is moving and how far the current price has deviated from that center point.

4. Real-Time Data Reporting In addition to the visual lines on the chart, the script provides a dynamic data summary in the corner of your screen. This updates automatically to show:

  • The current Maximum and Minimum for the day.
  • The current Average price.
  • The Width of the day's range (the total distance between high and low).
  • The Distance from the Average to both the opening price and the current closing price.

Summary of Purpose

This tool is ideal for traders who want to understand the "geometry" of a trading day. It helps you see where the price limits are set, how wide the daily volatility is, and exactly how far the current price has pulled away from the daily midpoint.

Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
KiS_Avg_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| KiS_max_min_Avg.mq4 |
//+------------------------------------------------------------------+
/*[[
Name := KiS_max_min_Avg
Author := KCBT
Link := http://www.kcbt.ru/forum/index.php?
]]*/

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 MediumOrchid
#property indicator_color2 Aqua
#property indicator_color3 MediumOrchid
//---- 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);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int shift, i, CurDay, BarCount;
double DayMax, DayMin;
double DayOpen, DayClose, Avg;

for (shift=Bars-1; shift>=0; shift--) {
if (CurDay != TimeDay(Time[shift])) {
for (i=BarCount; i>=0; i--) {
ExtMapBuffer1[shift+i] = DayMax;
ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
ExtMapBuffer3[shift+i] = DayMin;
}
CurDay = TimeDay(Time[shift]);
BarCount = 0;
DayMax = 0;
DayMin = 1000; //Çàðàíåå áîëüøå, ÷òîá óìåíüøèëñÿ â ïðîöåññå
DayOpen = Open[shift];
}
if (DayMax < High[shift]) {DayMax = High[shift];}
if (DayMin > Low[shift]) {DayMin = Low[shift];}
BarCount = BarCount + 1;
}

// ýòî äîðèñîâêà ïîñëåäíåãî, íåçàâåðøåííîãî åùå, äíÿ
for (i=BarCount; i>=0; i--) {
ExtMapBuffer1[shift+i] = DayMax;
ExtMapBuffer2[shift+i] = (DayMax+DayMin)/2;
ExtMapBuffer3[shift+i] = DayMin;
}
DayClose = Close[0];
Avg = (DayMax+DayMin)/2; //ñðåäíÿÿ çà òåêóùèé äåíü

Comment("Max:", DayMax," Min:", DayMin, "\n", "Avg:", Avg, " Width:", (DayMax-DayMin)/Point,"\n","From Avg to Open:",MathRound(MathAbs(Avg-DayOpen)/Point),"\n","From Avg to Close:",MathRound(MathAbs(Avg-DayClose)/Point));
return(0);
}
//+------------------------------------------------------------------+ 

Comments