DOSR_v1

The Daily Open-SR Technique is a visual trading tool designed to simplify technical analysis by automatically identifying key price levels based on the previous day's market activity. Instead of requiring manual charting, this script analyzes historical data to project significant boundaries onto your current chart, helping traders visualize where the market might face pressure or find stability.

How the Logic Works

The script functions by evaluating the relationship between the opening and closing prices of the completed trading day (the previous day). It uses these two data points to determine the "character" of that day's price action:

  • Bullish Days (Closing Price $\ge$ Opening Price): If the market ended higher than it started, the script identifies the day's High as a primary Resistance level (where sellers may step in) and the Opening price as a Support level (where buyers may enter).
  • Bearish Days (Closing Price $<$ Opening Price): If the market ended lower than it started, the logic flips. It identifies the day's Opening price as the Resistance level and the Low as the Support level.

Key Visual Elements

To provide a clear overview of the current trading environment, the script draws three distinct horizontal lines on your chart:

  1. Resistance Line (Red): Dynamically placed based on whether the previous day was bullish or bearish to indicate the "ceiling" of the price action.
  2. Support Line (Blue): Dynamically placed to indicate the "floor" of the price action.
  3. Today’s Open (Yellow): A constant reference line that marks exactly where the current trading day began, allowing you to see the price relative to the day's starting point at a glance.

Core Benefits for Traders

By automating these calculations, the script removes the guesswork from identifying "S/R" (Support and Resistance) levels. It ensures that your reference points are consistently derived from the prior day's actual movement, providing a structured visual framework to help you decide when to enter, exit, or manage your positions during the live market session.

Price Data Components
Series array that contains close prices for each barSeries array that contains open prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
9 Views
0 Downloads
0 Favorites
DOSR_v1
//+------------------------------------------------------------------+
//|                  Daily Open-SR Technique                         |
//|                                                         DOSR.mq4 |
//|                                              Developed by mqldev |
//|                                            http://www.mqldev.com |
//+------------------------------------------------------------------+

#property link      "http://www.mqldev.com"


#property indicator_chart_window

extern color   ResistanceColor = Red;
extern color   SupportColor    = Blue;
extern color   TodayOpenColor  = Yellow;

int init()
{
   DelObjs();
   return(0);
}
int deinit()
{
   DelObjs();
   return(0);
}

void start()
{
   double c = iClose(NULL,PERIOD_D1,1);
   double o = iOpen(NULL,PERIOD_D1,1);
   double h = iHigh(NULL,PERIOD_D1,1);
   double l = iLow(NULL,PERIOD_D1,1);
   double to = iOpen(NULL,PERIOD_D1,0);
   
   
   Print("close:",c," open:",o," high:",h," low:",l);
   
   if (c>=o)
   {
      DrawLine(h,"Resistance",ResistanceColor);
      DrawLine(o,"Support",SupportColor);
   }
   else
   {
      DrawLine(o,"Resistance",ResistanceColor);
      DrawLine(l,"Support",SupportColor);
   }
      DrawLine(to,"Today Open",TodayOpenColor);

   return(0);
}

int DrawLine(double price  , string Obj , color clr)
{

   int objs = ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
   {
      name=ObjectName(cnt);
      if (StringFind(name,Obj,0)>-1) 
      {
         ObjectMove(Obj,0,Time[0],price);
         ObjectsRedraw();
         return(1);
      }
   }
   ObjectCreate(Obj,OBJ_HLINE,0,0,price);
   ObjectSet(Obj,OBJPROP_COLOR,clr);
   WindowRedraw();
   return(0);
}

void DelObjs()
{
   int objs = ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
   {
      name=ObjectName(cnt);
      if (StringFind(name,"L",0)>-1) ObjectDelete(name);
      WindowRedraw();
   }
}


Comments