Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1893

 
Vitaly Muzichenko #:

There is such a thing on the graphic

I've seen it done in any colour, if I'm not mistaken.

How?

F8 and.


But this is also the colour of the grid, so uncheck


 
Artyom Trishkin #:

F8 and

But this is also the colour of the grid, so uncheck

Got it, thanks!

The grid is needed, too bad it's not separated.

P.S. How do you shift 15 bars from the right-hand edge programmatically?
 
Vitaly Muzichenko #:

Got it, thanks!

The grid is needed, too bad it's not divided.

P.S. How do you shift 15 bars from the right edge programmatically?

How about this?

//+------------------------------------------------------------------+
//| Функция включает/выключает режим отображения ценового графика с  |
//| отступом от правого края.                                        |
//+------------------------------------------------------------------+
bool ChartShiftSet(const bool value,const long chart_ID=0)
  {
//--- сбросим значение ошибки
   ResetLastError();
//--- установим значение свойства
   if(!ChartSetInteger(chart_ID,CHART_SHIFT,0,value))
     {
      //--- выведем сообщение об ошибке в журнал "Эксперты"
      Print(__FUNCTION__+", Error Code = ",GetLastError());
      return(false);
     }
//--- успешное выполнение
   return(true);
  }
Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Примеры работы с графиком
Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Примеры работы с графиком
  • www.mql5.com
Примеры работы с графиком - Константы графиков - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexey Viktorov #:

How about this?

Yes, but that's pushing the button away

When you drag the marker with your hands, it rests before reaching the right edge quite a bit - this is a fundamentally wrong limitation of the terminal!

When you press the button, the outermost bar almost sticks to the right edge, so the information value of the chart is lost.

You should press the button without reaching 15-20 bars and not perform this operation every time a new bar appears. Compress only once.

P.S. Why such a restriction and so much empty space?


 
Vitaly Muzichenko #:

Yes, but it's pushing the button away.

When you drag the marker with your hands, it rests before reaching the right edge quite a lot - this is a fundamentally wrong limitation of the terminal!

When you press the button, the outermost bar almost sticks to the right edge, so the information value of the chart is lost.

You should press the button without reaching 15-20 bars and not perform this operation every time a new bar appears. Compress only once.

Percentage

//+------------------------------------------------------------------+ 
//| Функция устанавливает размер отступа нулевого бара от правого    | 
//| края графика в процентах (от 10% до 50%). Для включения режима   | 
//| отступа, нужно установить значение свойства CHART_SHIFT равным   | 
//| true.                                                            | 
//+------------------------------------------------------------------+ 
bool ChartShiftSizeSet(const double value,const long chart_ID=0) 
  { 
//--- сбросим значение ошибки 
   ResetLastError(); 
//--- установим значение свойства 
   if(!ChartSetDouble(chart_ID,CHART_SHIFT_SIZE,value)) 
     { 
      //--- выведем сообщение об ошибке в журнал "Эксперты" 
      Print(__FUNCTION__+", Error Code = ",GetLastError()); 
      return(false); 
     } 
//--- успешное выполнение 
   return(true); 
  }
 
Alekseu Fedotov #:

Percentage

Works, but the minimum is an indentation that can be set by hand and at least

Visually, it's about a 10% minimum. Why doesn't 5% work

 
Vitaly Muzichenko #:

Works, but the minimum is an indentation that can be set by hand and at least

Yes, no less than 10% of the window.

 
Alekseu Fedotov #:

Yes, at least 10% of the window.

So it turns out badly.


 

Good afternoon everyone. I have 20 tools open and need to load the same template on all of them. Is it possible to automate this with a script? If so, can you please share the code on how to do it?

 
DanilaMactep #:

Good afternoon everyone. I have 20 tools open and need to load the same template on all of them. Is it possible to automate this with a script? If so, please share the code how to do it?

make a script - go through the charts one by one ( ChartFirst(), ChartNext() ) and apply the required template ( ChartApplyTemplate() ) to them

You can check it out here :https://www.mql5.com/ru/blogs/post/747636 or customize it

Полезняшки - скрипт для открытия чартов
Полезняшки - скрипт для открытия чартов
  • www.mql5.com
Небольшой скрипт, открывает недостающие пары и применяет туда шаблон
Reason: