DOSR_v2

The Daily Open-SR Technique is a visual trading tool designed to simplify chart analysis by automatically identifying key price levels based on the previous day's market activity. By highlighting significant milestones, it helps traders quickly recognize potential areas of interest without having to manually calculate historical data.

Core Logic and Functionality

The script operates by analyzing the price action of the completed previous trading day to establish three primary visual indicators on your current chart:

1. Dynamic Support and Resistance Levels The tool determines whether the previous day ended with a "bullish" or "bearish" sentiment to decide which price points serve as the strongest barriers:

  • Bullish Day: If the previous day closed at a higher price than it opened, the script identifies the High of that day as a Resistance level and the Open as a Support level.
  • Bearish Day: If the previous day closed lower than it opened, the script identifies the Open as a Resistance level and the Low of that day as a Support level.

By automatically switching these levels based on price action, the tool ensures that the most relevant "floors" and "ceilings" are always visible to the user.

2. The Current Day’s Opening Price In addition to the historical levels, the script identifies and plots the Opening Price of the current day. This provides a constant reference point for traders to see how far the price has moved away from its starting position throughout the ongoing session.

Visual Experience

To ensure clarity on the chart, the script uses a distinct color-coding system:

  • Resistance Levels are highlighted in Red, signaling potential zones where the market may face selling pressure.
  • Support Levels are highlighted in Blue, indicating areas where the market may find buying interest.
  • Today's Open is marked in Yellow, providing a clear visual anchor for the current day's price progress.

Automated Management

The script handles all the "heavy lifting" of chart management. It automatically creates these horizontal lines and updates their positions in real-time as new data arrives. Furthermore, it includes an automated cleanup process that removes old lines when they are no longer needed, ensuring your workspace remains clean, organized, and focused on the most relevant price data.

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
10 Views
0 Downloads
0 Favorites
DOSR_v2
//+------------------------------------------------------------------+
//|                  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