Drawing a square or rectangle. Really need help... - page 4

 
Alex_Profit:

It turns out that when an object is created, the value "_H", _L", is attributed.

Well, you have to think about it, I agree. And I don't drink much.

I think it'll get better with time. Thank you.

objName+"_H",

objName+"_L",

I wasn't talking about you... I wasn't very sober when I wrote that answer.
 
Thank you Agramenne. Stage 1 is over.
 
Can you tell me for some reason when you change indicator_chart_window parameter toindicator_separate_window the main window picture is not displayed in the sub-window.
 
Alex_Profit:
Can you tell me for some reason when you change indicator_chart_window parameter toindicator_separate_window the main window picture is not displayed in the sub window.
The indicator needs to be removed from the chart and added again.
 

Please tell me if there is an error. What needs to be changed so that the rhombus and cross are drawn over the bar itself and not on the zero bar. (on the first bar of each month).

Thank you.

//+------------------------------------------------------------------+

#property strict

#property indicator_chart_window

   

    //---  Внешние Глобальные переменные 

extern int     barsToProcess = 5;        //--- Кол-во отображаемых периодов (линий) 


    //---  Глобальные переменные    

string Name_Obj;  //--- Имя Элементов


#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue


double Buf_High[];

double Buf_Low[];


MqlDateTime mqlDateTime;

MqlRates    mqlRates[1];


//+------------------------------------------------------------------+

int init()

  {  

     SetIndexBuffer(0,Buf_High);     

     SetIndexStyle (0,DRAW_ARROW,0,0);  

     SetIndexArrow (0,116);

     

     SetIndexBuffer(1,Buf_Low);

     SetIndexStyle (1,DRAW_ARROW,0,0); 

     SetIndexArrow (0,116);


    return(0);

  }

//+------------------------------------------------------------------+

int deinit()

  {

   int i;  

         for (i=0; i<Bars; i++)                                        //--- Выбираем все установленные объекты  

           {

              ObjectDelete(Name_Obj  + " High"   + DoubleToStr(i,0));  //--- Удаляем все объекты

              ObjectDelete(Name_Obj  + " Low"    + DoubleToStr(i,0));  //--- Удаляем все объекты

           }       

   return(0);

  }

//+------------------------------------------------------------------+

int start()

{                  

int counted_bars = IndicatorCounted();     //--- перем counted_bars = функц.  Возвращает количество баров

int limit;                                 //--- переменная  старт кол-во баров. Линии рисуем о по всем барам

if(counted_bars > 0) counted_bars --;      //--- последний посчитанный бар будет пересчитан 

  //--- основной цикл 

  limit = Bars - counted_bars;         

  for(int i = 0; i < limit; i ++)

      {

 //+------------------------ При выборе кол-ва линий отобразим их ко-во------------------------+                 

         if(limit > barsToProcess)                                     //--- Если кол-во линий > Кол-ву отображаемых периодов (линий) 

         {

          limit = barsToProcess;                                       //--- Тогда устанавливаем Кол-во отображаемых периодов (линий)

 //+------------------------ Рисуем линии -----------------------------------------------------+                 

             while (i<limit)                                           //--- Пока есть линии в окне терминала. Или пока висит индикатор в окне терминала.                        

             {   

               datetime t_Line = iTime(Symbol(),PERIOD_MN1,i);         //--- В ПЕРЕМ t_Line Будет Присваиваться значение времени открытия бара

               CopyRates(_Symbol, PERIOD_W1, t_Line, 1, mqlRates);

   {

             Buf_High[i] = mqlRates[i].high;

             Buf_Low[i]  = mqlRates[i].low;

      //+------------------------ Рисуем Объекты -----------------------------------------------------+                 

      //--- Строим линию по Хай      

     ObjectCreate    (0,Name_Obj + " High" + DoubleToStr(i,0), OBJ_TREND, 0,t_Line, mqlRates[0].high,t_Line+PeriodSeconds(PERIOD_MN1),mqlRates[0].high);

     ObjectSetInteger(0,Name_Obj + " High" + DoubleToStr(i,0), OBJPROP_RAY_RIGHT, false);

  

     //--- Строим линию по Лоу      

     ObjectCreate    (0,Name_Obj + " Low" + DoubleToStr(i,0), OBJ_TREND, 0,t_Line, mqlRates[0].low,t_Line+PeriodSeconds(PERIOD_MN1),mqlRates[0].low);

     ObjectSetInteger(0,Name_Obj + " Low" + DoubleToStr(i,0), OBJPROP_RAY_RIGHT, false);

 }

  i++;

             }

          }

      }

   return(0);

}


 
Alex_Profit:

Please tell me if there is an error. What needs to be changed so that the rhombus and cross are drawn over the bar itself and not on the zero bar. (on the first bar of each month).

Thank you.

Start learning the new syntax already, I would understand an old dinosaur who only wrote in the old language and has no desire to retrain, but having just started to learn and stand on a syntax that has been obsolete for several years with a splash of new, it's perverse.

And just start reading the help so that you at least understand what's going on.

 

It's understandable, but where is the new and where is the old? And I read the handbook, it's written in too clever a language.

Thank you especially for the criticism. It helps me move in the right direction.

 

Can you give me a hint? How do I make mark-ups for quarterly periods?

I need to draw vertical lines when these dates occur.

January 1.April 1.July 1.October 1.

 

First read my words carefully, then read the language documentation, in particular the "Graphical Objects" section.

The documentation clearly states what parameters must be present when creating a graphical object. One of them is TIME - these are your dates you need to put into this parameter. The price is not important for vertical lines, but it is necessary for the function. There is no difficulty in doing this.

 
AlexeyVik:

First read my words carefully, then read the language documentation carefully, in particular the "Graphic Objects" section.

The documentation clearly says which parameters should be present when creating a graphical object. One of them is TIME these are your dates and should be inserted in this parameter. The price is not important for the vertical lines, but it is mandatory for the function, so you have to put 0. There is no difficulty in doing this.

I don't know how to do it. Please tell me how to do it. The maximum period is a month.

In variablet_Line. we need to insert the value of 1st,2nd,3rd,4th, kv.

I can not understand.

I would appreciate it.

int start()

{                  

int counted_bars = IndicatorCounted();     //--- перем counted_bars = функц.  Возвращает количество баров

int limit;                                 //--- переменная  старт кол-во баров. Линии рисуем о по всем барам

   

if(counted_bars > 0) counted_bars --;      //--- последний посчитанный бар будет пересчитан 

  //--- основной цикл 

  limit = Bars - counted_bars;         

  for(int i = 0; i < limit; i ++)

      {

         if(limit > barsToProcess)                                     //--- Если кол-во линий > Кол-ву отображаемых периодов (линий) 

         {

          limit = barsToProcess;                                      //--- Тогда устанавливаем Кол-во отображаемых периодов (линий)

             while (i<limit)                                           //--- Пока есть линии в окне терминала. Или пока висит индикатор в окне терминала.                        

             {   

               datetime t_Line = iTime(Symbol(),PERIOD_MN1,i);                 //--- В ПЕРЕМ t_Line Будет Присваиваться значение времени открытия бара

             {


    ObjectCreate (Name_VLine + " VLine" + DoubleToStr(i,0),OBJ_VLINE,0,t_Line,0);         //--- Создаём обьект вертикальную линию

    ObjectSet    (Name_VLine + " VLine" + DoubleToStr(i,0),OBJPROP_STYLE,2);              //--- Со стилем

    ObjectSet    (Name_VLine + " VLine" + DoubleToStr(i,0),OBJPROP_COLOR,DimGray);        //--- Со цветом  

    ObjectSet    (Name_VLine + " VLine" + DoubleToStr(i,0),OBJPROP_WIDTH,0);              //--- С  толщиной

    ObjectSet    (Name_VLine + " VLine" + DoubleToStr(i,0),OBJPROP_BACK,0);               //--- С типом отображения. Объект на заднем плане

 }

  i++;

             }

          }

      }      

   return(0);

}