Twenty four

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

This tool is designed to help traders visualize price movements by automatically identifying and marking specific structural points on a trading chart. Instead of cluttering the screen with constant data, it focuses on isolating key transitional moments between different trading days.

Core Logic Overview

The script functions by scanning the historical price data starting from the beginning of the previous month. It systematically looks for "day breaks"—the specific moments when one calendar day ends and a new one begins.

How it Works

  • Trend Identification: For every new day detected, the tool calculates a central price point. It does this by taking the average of the opening and closing prices of that specific period. This average serves as a foundational "trend" marker for that day.
  • Visual Trend Mapping: The tool then draws a connected line (a section) across these calculated points. This allows you to see the progression of price levels from one day to the next in a continuous flow, making it easier to identify the overall direction of the market.
  • Session Markers: In addition to the trend line, the script places specific visual markers (arrows) at the start of each new trading session. These act as anchors, highlighting exactly where the price transitioned into a new daily cycle.
  • Reference Points: For every day except the very first one in the data set, the tool adds an extra reference mark. This specifically highlights the starting price of the previous period, allowing you to compare the current day's opening position against where the previous day concluded.

Summary for the User

Essentially, this script cleans up the "noise" of a busy chart by highlighting the transition between days. It provides a bird's-eye view of the market's daily progression by plotting a trend line based on average price points and clearly marking each new session with visual indicators. This helps you quickly see how the market is moving day-over-day without having to manually calculate averages or identify day shifts.

Miscellaneous
Implements a curve of type %1
15 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
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
// Ïîñëåäíèé äåíü ïðåäûäóùåãî ìåñÿöà.
   datetime BeginDay=StrToTime(StringConcatenate(Year(),".",Month()-1 ));
   
// Êîìàíäà äëÿ âûïîëíåíèÿ ôóíêöèè.
   DayTimeTrend(BeginDay);
   return(0);
  }
//+------------------------------------------------------------------+
//| Òðåíä                                                            |
//+------------------------------------------------------------------+
void DayTimeTrend(datetime BeginDay)
     {
// Êîëè÷åñòâî áóôåðîâ:
      #property indicator_buffers 2

// Ïåðåìåííûå öèêëà:
      int t;
      double PointDay[];
      double TrendDay[];
      double Trend;
      double Beg=iBarShift(NULL,0,BeginDay);

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

// Ëèíèÿ òðåíäà:
        TrendDay[t]=Trend; 
        SetIndexBuffer(0,TrendDay);
         SetIndexStyle(0,DRAW_SECTION,NULL,1,PaleVioletRed);
         SetIndexLabel(0,"TrendDay");

// Òî÷êà íà÷àëà òîðãîâîé ñåññèè:
        PointDay[t]=Trend;
        SetIndexBuffer(1,PointDay);
         SetIndexStyle(1,DRAW_ARROW,NULL,2,IndianRed);
         SetIndexArrow(1,159);
         SetIndexLabel(1,"PointDay");

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

Comments