Twenty_four

Download script
Author: Copyright � 2009, MetaQuotes Software Corp.

The "Twenty four" indicator is designed to provide traders with a visual summary of daily price action by identifying key structural points within the current month. Instead of focusing on every minor fluctuation, it simplifies the market view by highlighting specific data for each new trading day.

Core Functionality

The logic operates by scanning the price history starting from the first day of the previous month. It systematically moves through the chart to identify exactly when a new calendar day begins. Every time the script detects a transition into a new day, it performs the following actions:

  • Trend Identification: It calculates a representative price for that specific day by taking the average of the opening and closing prices.
  • Visual Mapping: It creates a "TrendDay" line to represent these calculated values, allowing you to see the progression of daily averages over time.
  • Session Marking: For each new day, it places a visual marker (an arrow) at the specific price point where that day began.

Key Features for the User

  • Automatic Daily Tracking: You don't need to manually identify where one day ends and another begins; the script handles this detection automatically based on time stamps.
  • Visual Clarity: By plotting a dedicated line and specific arrows, the tool helps you distinguish between different trading sessions quickly.
  • Historical Context: Because it looks back to the beginning of the previous month, it provides a consistent visual history rather than just showing the most recent data points.

In short, this tool acts as a structural map for your chart. It filters out the "noise" of intra-day movement to show you the average price levels and starting points for every day in the current monthly cycle.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
Twenty_four
//+------------------------------------------------------------------+
//|                                                  Twenty four.mq4 |
//|                                                        Èìÿ: Ñàøà |
//|                                 mailto: marketadviser@rambler.ru |
//|                                                                  |
//| Êàòàëîã óñòàíîâêè:                                               |
//| C:\Program Files\ - Òåðìèíàë - \experts\indicators\              |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
double PointDay[];
double TrendDay[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,TrendDay);
   SetIndexStyle(0,DRAW_SECTION,NULL,1,PaleVioletRed);
   SetIndexLabel(0,"TrendDay");
   SetIndexBuffer(1,PointDay);
   SetIndexStyle(1,DRAW_ARROW,NULL,2,IndianRed);
   SetIndexArrow(1,159);
   SetIndexLabel(1,"PointDay");

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
// Ïîñëåäíèé äåíü ïðåäûäóùåãî ìåñÿöà.
   datetime BeginDay=StrToTime(StringConcatenate(Year(),".",Month()-1)+".01");
// Êîìàíäà äëÿ âûïîëíåíèÿ ôóíêöèè.
   DayTimeTrend(BeginDay);

   return(0);
  }
//+------------------------------------------------------------------+
//| Òðåíä                                                            |
//+------------------------------------------------------------------+
void DayTimeTrend(datetime BeginDay)
  {
// Êîëè÷åñòâî áóôåðîâ:
#property indicator_buffers 2

// Ïåðåìåííûå öèêëà:

   double Trend;
   double Beg=iBarShift(NULL,0,BeginDay);

   for(int y=Beg; y>=0; y--)
     {
      if(TimeDay(Time[y])!=TimeDay(Time[y+1])) int t=y;
        {
         Trend=(Open[t]+Close[t])/2;

         // Ëèíèÿ òðåíäà:
         TrendDay[t]=Trend;

         // Òî÷êà íà÷àëà òîðãîâîé ñåññèè:
         PointDay[t]=Trend;

         // Îòìåòêà ñðåäíåé öåíû íà÷àëà òîðãîâ:
         if(y!=Beg)
           {
            ObjectCreate("OpenDay"+t,OBJ_ARROW,0,Time[t],Trend);
            ObjectSet("OpenDay"+t,OBJPROP_ARROWCODE,SYMBOL_LEFTPRICE);
            ObjectSet("OpenDay"+t,OBJPROP_COLOR,Red);
           }
        }
     }
  }
//+------------------------------------------------------------------+

Comments