PrevDay-HiLo-kelvin_v1

Download script
Author: Copyright � 2005, Fermin Da Costa Gomez
PrevDay-HiLo-kelvin_v1

This tool is designed to provide traders with a clear visual reference of key price levels from the previous trading day. By automatically plotting specific historical milestones onto your current chart, it helps you identify significant support and resistance zones based on yesterday's market activity.

Core Functionality

The logic focuses on capturing three specific data points from every completed trading day:

  • Previous Day High: The highest price reached during the prior day.
  • Previous Day Low: The lowest price reached during the prior day.
  • Previous Day Open: The exact price at which the previous day's trading began.

How the Logic Works

The script continuously monitors the price action as new candles form. It performs the following steps automatically:

  1. Daily Tracking: The tool scans through historical price data to identify when one trading day ends and a new one begins.
  2. Extreme Identification: As the market moves, the logic constantly updates its memory of the highest and lowest points reached during that current 24-hour cycle.
  3. Data Transition: Once a new day starts, the script "locks in" the highs and lows from the day that just finished. It then saves these values as the "Previous Day" levels for your current view.
  4. Visual Plotting: The script draws three distinct lines on your chart:
    • The High and Low levels are displayed in a light blue (Aqua) color, allowing you to see where the price pushed furthest in the past.
    • The Opening price is highlighted in Red, making it easy to distinguish where the previous session started.

Practical Use for Traders

Instead of manually looking up yesterday's stats in a spreadsheet or history tab, this script places that information directly on your live chart. This allows you to see at a glance whether the current price is trading above or below yesterday's range, helping you make faster decisions regarding potential trend reversals or breakouts.

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

/*+------------------------------------------------------------------+
 | FileName: i_DCG_Camarilla.mq4
 | Author: Copyright © 2005, Fermin Da Costa Gomez
 | Version : 01 (Inital code)
 | 
 +------------------------------------------------------------------+*/
#property copyright "Copyright © 2005, Fermin Da Costa Gomez"
#property link      "http://forex.viahetweb.nl"

#property indicator_chart_window
#property indicator_buffers 3

#property indicator_color1 Aqua
#property indicator_color2 Aqua
#property indicator_color3 Red

//---- input parameters

//---- buffers

double PrevDayHiBuffer[];
double PrevDayLoBuffer[];
double PrevDayOpenBuffer[];

int fontsize=10;
double PrevDayHi, PrevDayLo, PrevDayOpen;
double LastHigh,LastLow,x;



//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

   
   ObjectDelete("PrevDayHi");
   ObjectDelete("PrevDayLo"); 
   ObjectDelete("PrevDayOpen");    
//
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;


//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   
  
   SetIndexBuffer(0, PrevDayHiBuffer);
   SetIndexBuffer(1, PrevDayLoBuffer);
   SetIndexBuffer(2, PrevDayOpenBuffer);
   


//---- name for DataWindow and indicator subwindow label
   short_name="Prev Hi-Lo levels";
   IndicatorShortName(short_name);
   SetIndexLabel(0, short_name);

//----
   SetIndexDrawBegin(0,1);
//----
 

//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   int    counted_bars=IndicatorCounted();

   int limit, i;
//---- indicator calculation
if (counted_bars==0)
{
   x=Period();
   if (x>240) return(-1);
   ObjectCreate("PrevDayHi", OBJ_TEXT, 0, 0, 0);
   ObjectSetText("PrevDayHi", "                Prev. Day High",fontsize,"Arial", Aqua);
   ObjectCreate("PrevDayLo", OBJ_TEXT, 0, 0, 0);   
   ObjectSetText("PrevDayLo", "                Prev. Day Low",fontsize,"Arial", Aqua); 
ObjectCreate("PrevDayOpen", OBJ_TEXT, 0, 0, 0);
   ObjectSetText("PrevDayOpen", "                Prev. Day Open",fontsize,"Arial", Red);
   //---- last counted bar will be recounted
//   if(counted_bars>0) counted_bars--;
} 
  limit=(Bars-counted_bars)-1;



for (i=limit; i>=0;i--)
{ 

if (High[i+1]>LastHigh) LastHigh=High[i+1];
if (Low[i+1]<LastLow) LastLow=Low[i+1];
//Print("TimeDay(Time[i]=",TimeDay(Time[i]),"TimeDay(Time[i+1])",TimeDay(Time[i+1]));
if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
   { 
   PrevDayHi=LastHigh;
PrevDayLo=LastLow;
PrevDayOpen=Open[i];
   LastLow=Open[i];
   LastHigh=Open[i];

  
   ObjectMove("PrevDayHi", 0, Time[i], PrevDayHi);
   ObjectMove("PrevDayLo", 0, Time[i], PrevDayLo);
    ObjectMove("PrevDayOpen", 0, Time[i], PrevDayOpen);

   }
   
    PrevDayHiBuffer[i]=PrevDayHi;
    PrevDayLoBuffer[i]=PrevDayLo;
    PrevDayOpenBuffer[i]=PrevDayOpen;
}

//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments