индикатор XLO1 - страница 2

 
Vladimir Karputov:

Линии в смысле графический объект "Горизонтальная линия" или линии в смысле стиль рисования DRAW_LINE?

DRAW_LINE

 

Э- э-х х    положу и свои пять копеекъ


А можно добавить опцию для Н4 и Д,  чтобы уровни продлевались соответственно на неделю и месяц?

 
//+------------------------------------------------------------------+
//|                                           High Low First Bar.mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.000"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
//--- plot High
#property indicator_label1  "High"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrTomato
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot Low
#property indicator_label2  "Low"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrSlateBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- indicator buffers
double         HighBuffer[];
double         LowBuffer[];
//---
int            day_of_year;
datetime       first_bar;
double         first_high;
double         first_low;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,HighBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,LowBuffer,INDICATOR_DATA);
//--- setting a code from the Wingdings charset as the property of PLOT_ARROW
   PlotIndexSetInteger(0,PLOT_ARROW,119);
   PlotIndexSetInteger(1,PLOT_ARROW,119);
//--- set the vertical shift of arrows in pixels 
   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,-5);
   PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,5);
//---
   day_of_year=-1;
   first_bar=0;      // "0" -> D'1970.01.01 00:00';
   first_high=0.0;
   first_low=0.0;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int limit=prev_calculated-1;
   if(prev_calculated==0)
      limit=0;
   for(int i=limit;i<rates_total;i++)
     {
      MqlDateTime STime;
      TimeToStruct(time[i],STime);
      if(STime.day_of_year!=day_of_year)
        {
         day_of_year=STime.day_of_year;
         first_bar=time[i];
         first_high=high[i];
         first_low=low[i];
        }
      else if(first_bar==time[i])
        {
         first_high=high[i];
         first_low=low[i];
        }
      HighBuffer[i]=first_high;
      LowBuffer[i]=first_low;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


Блог слесаря-ремонтника и механика по наладке оборудования | Советы для ремонтников
Блог слесаря-ремонтника и механика по наладке оборудования | Советы для ремонтников
  • wmua.ru
С первого раза даже не поверил, что в таком небольшом чемоданчике можно разместить столько электроинструмента! В общем, как говорится, лучше один раз увидеть: С Праздником 8 Марта! С Праздником Весны! Милые дамы, женщины, мамы и бабушки. Поздравляю Вас с праздником весны, праздником жизни. Спасибо Вам за то, что Вы у нас есть. Спасибо Вам за...