Twenty_four

Author: Copyright � 2009, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
1 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

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---