Lines_HiLo_Yesterday

Download script
Author: TradeForex
Lines_HiLo_Yesterday

This technical indicator is designed to provide traders with a clear visual representation of price boundaries by identifying the highest and lowest price points reached during specific periods. By automating the identification of these levels, it helps traders better understand market volatility and structural boundaries on their charts.

Core Functionality

The script operates by scanning historical and current price data to establish two primary sets of benchmarks:

  • Previous Period Analysis: The tool automatically calculates the highest and lowest prices from the preceding period (e.g., yesterday). It then projects these values onto your current chart as distinct horizontal lines. This allows you to see exactly where the market "held" its ground in the past.
  • Current Period Tracking: Simultaneously, the indicator monitors the high and low points of the current active period. By visualizing these boundaries, traders can quickly identify the upper and lower limits of the current price action.

Key Features & Visual Aids

To ensure the information is easy to read at a glance, the script includes the following visual elements:

  • Dynamic Horizontal Lines: The indicator draws solid lines on the chart to represent both the previous period's extremes and the current period's boundaries.
  • On-Chart Labeling: Each line is accompanied by a text label (such as "Yesterdays High" or "Buy Line"), ensuring that you can immediately distinguish between different price levels without confusion.
  • Real-Time Updates: The script constantly recalculates these values as new price data arrives, meaning the lines move automatically to stay accurate to the live market movement.
  • Data Summary: There is an optional commentary feature that provides a text summary on the chart, displaying the calculated range of the previous period for quick reference.

How it Helps Your Trading

By providing these clear boundaries, the indicator removes the need for manual measurement. It allows you to:

  1. Identify Support and Resistance: See where price has historically turned around.
  2. Gauge Volatility: Compare the size of yesterday's price range against today's current movement.
  3. Simplify Chart Navigation: Keep your workspace clean by having the most important price levels automatically plotted and labeled for you.
11 Views
0 Downloads
0 Favorites
Lines_HiLo_Yesterday




//+------------------------------------------------------------------+
//|                                                        Lines_HiLo.mq4 |
//|                      
//|                                      
//+------------------------------------------------------------------+
#property copyright "TradeForex"
#property link      ""

#property indicator_chart_window




extern bool ViewComment = true;
double period_Low=0;
double period_High=0;

double Yester_High_Line=0;
double Yester_Low_Line=0;
double Todays_High_Line=0;
double Todays_Low_Line=0;

double Range = 0;

double Todays_High = 0;
double Todays_Low =  0;
double Range_Yesterday = 0;
double Todays_Range = 0;





//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{

   
}


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   ObjectDelete("BuyAt Label"); 
   ObjectDelete("BuyAt Line");
   ObjectDelete("SellAt Label");
   ObjectDelete("SellAt Line");
   
   return(0);
}
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
     
         period_High =High[Highest(NULL,0,MODE_HIGH,1,1)];
         period_Low =Low[Lowest(NULL,0,MODE_LOW,1,1)];
         
         
         Todays_High = High[Highest(NULL,0,MODE_HIGH,0,1)];
         Todays_Low =  High[Highest(NULL,0,MODE_HIGH,0,1)];
         Range_Yesterday = (period_High - period_Low) * Point;
         Todays_Range = (Todays_High - Todays_Low) * Point;
        
         Yester_High_Line =  (period_High );
         Yester_Low_Line =  (period_Low  );
   
   if (ViewComment==true){

   Comment("Yesterdays Range = ","  ", Range);
      }

 
   {
      SetLevel("Yesterdays High", Yester_High_Line, Green); //Blue
      SetLevel("Yesterdays Low", Yester_Low_Line, Green); //Blue
      SetLevel("Buy Line ", Todays_High_Line, Blue); //Green
      SetLevel("Sell line", Todays_Low_Line, Blue); //Red
        
      
   
   }

  
   return(0);
}


//+------------------------------------------------------------------+
//| Helper                                                           |
//+------------------------------------------------------------------+
void SetLevel(string text, double level, color col1)
{
   string labelname= text + " Label";
   string linename= text + " Line";

   if (ObjectFind(labelname) != 0) {
      ObjectCreate(labelname, OBJ_TEXT, 0, Time[20], level);
      ObjectSetText(labelname, " " + text, 8, "Arial", White);
   }
   else {
      ObjectMove(labelname, 0, Time[20], level);
   }
   
   if (ObjectFind(linename) != 0) {
      ObjectCreate(linename, OBJ_HLINE, 0, Time[40], level);
      ObjectSet(linename, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet(linename, OBJPROP_COLOR, col1);
      
      }
   else {
      ObjectMove(linename, 0, Time[40], level);
      
   }
}
      

Comments