TodayHighLow

Download script
Author: Copyright � 2008, Serega Lykov
TodayHighLow

This tool is designed to provide traders with a clear visual reference for the highest and lowest price points reached during the current trading day. By automatically identifying these key levels, it helps you understand the boundaries of the day's price action at a glance.

How the Logic Works

The script operates by scanning the historical price data specifically linked to the daily timeframe. Instead of looking at short-term fluctuations or minute-by-minute changes, it focuses on the "Daily" (D1) data to determine the overall range of the market for each specific point in time.

Key Functions:

  • Dynamic Tracking: The script calculates how many price bars have passed today based on the timeframe you are currently viewing. This ensures that whether you are looking at a 5-minute chart or a 1-hour chart, the data remains relevant to the current day's progress.
  • Price Identification: It automatically retrieves two specific values from the daily history: the maximum price (High) and the minimum price (Low).
  • Visual Mapping: Once these values are identified, the script draws two distinct lines on your trading chart. One line represents the "Today's High" and the other represents the "Today's Low."
  • Real-Time Updates: The logic is designed to refresh as new data comes in, allowing you to see how the current price moves relative to the day's extremes in real-time.

Practical Use

For a trader, this means you can immediately see the "ceiling" and the "floor" of the current trading session. It removes the manual work of searching through previous candles to find where the price peaked or dipped today, allowing for quicker analysis of market volatility and trend boundaries.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
TodayHighLow
//+------------------------------------------------------------------+
//|                                                 TodayHighLow.mq4 |
//|                                These are the todays high and low |
//|                                   Copyright © 2008, Serega Lykov |
//|                                       http://mtexperts.narod.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Serega Lykov"
#property link      "http://mtexperts.narod.ru/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

double HighBuffer[];
double LowBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   IndicatorDigits(Digits);
   IndicatorShortName("Today High/Low");
   SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);
   SetIndexLabel(0,"Today High");
   SetIndexLabel(1,"Today Low");
   return(0);
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
   int today_bars = 1440/Period();
   if(counted_bars < today_bars) int limit = today_bars;
   else limit = counted_bars;
   for(int i=0; i<=limit; i++)
     {
      HighBuffer[i] = iHigh(NULL,PERIOD_D1,iBarShift(NULL,PERIOD_D1,Time[i]));
      LowBuffer[i] = iLow(NULL,PERIOD_D1,iBarShift(NULL,PERIOD_D1,Time[i]));
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments