Questions from Beginners MQL5 MT5 MetaTrader 5 - page 627

 
Roman Shiredchenko:

This is understandable... Maybe a short example for one variable and that's it... Although it looks like I'll find something in the help there myself...

Thank you. How to write them to the buffer, I mean what type of buffer to organize.... here in principle the lines on this indicator are not needed...

If you don't need lines, but want to take some values from indicator buffers, create a graphical construction with DRAW_NONE type. Look how it is implemented in Help.

But to be honest, I do not really understand why you should use an indicator for this purpose.

 
Alexey Volchanskiy:
Absolutely no way, same with comment. Only reopen with a different magik
hmm (
 

The simplest question, jammed.

How do I get the number of bars that are visible in the chart window? (MQL4)

 
new-rena:

The simplest question, jammed.

How do I get the number of bars that are visible in the chart window? (MQL4)

//+------------------------------------------------------------------+ 
//| Функция получает количество баров, которые отображаются (видимы )| 
//| в окне графика.                                                  | 
//+------------------------------------------------------------------+ 
int ChartVisibleBars(const long chart_ID=0) 
  { 
//--- подготовим переменную для получения значения свойства 
   long result=-1; 
//--- сбросим значение ошибки 
   ResetLastError(); 
//--- получим значение свойства 
   if(!ChartGetInteger(chart_ID,CHART_VISIBLE_BARS,0,result)) 
     { 
      //--- выведем сообщение об ошибке в журнал "Эксперты" 
      Print(__FUNCTION__+", Error Code = ",GetLastError()); 
     } 
//--- вернем значение свойства графика 
   return((int)result); 
  }
 
Vladislav Andruschenko:
THANK YOU SO MUCH!
 
Alexey Kozitsyn:

If lines are not needed, but you want to take some values from indicator buffers, then create a graphical drawing with DRAW_NONE type. Look how it is implemented in the help.

To be honest, I do not really understand why we should use the indicator for this purpose...

The thing is, I'm going to check it myself, that if I insert the same code for working with ticks into Expert Advisor, it may lead to loss of ticks in a robot. To be more precise, not because of the code, but in general. The Expert Advisor supposedly can skip ticks (when it executes the start function) but the indicator cannot. Especially when the speed of their arrival to the terminal is high. Therefore, perhaps it is necessary to work through the indicator to correctly handle ticks or not? Who considers it? Please advise.

 
Roman Shiredchenko:

The thing is, I'm going to check it myself by comparison, that it seems that if the same code for working with ticks is inserted in EA, it is possible to lose ticks in the robot. To be more precise, not because of the code, but in general. The Expert Advisor supposedly can skip ticks (when it executes the start function) but the indicator cannot. Especially when the speed of their arrival to the terminal is high. Therefore, perhaps it is necessary to work through the indicator to correctly handle ticks or not? Who considers it? Please advise...

About the ticks - I agree, but even the indicator, as far as I know, will not solve all the problems. In order to really get all ticks it is necessary to use CopyTicks() function (for MT5). But there is a problem with it now.

https://www.mql5.com/ru/forum/42122/page17#comment_2835080

If we are talking about MT4 - the indicator is definitely better.

Тестируем 'CopyTicks'
Тестируем 'CopyTicks'
  • www.mql5.com
Индикатор с тиковым объемом прилагается ( скомпилирован на МТ5-1100).
 
Alexey Volchanskiy:

Only analyze log files like \logs\20160922.log. But we cannot get them from MQL4/5, only \MQL5\Files folder is available for reading/writing.

So, we need to write an external script which will read the log, analyze it and inform MQL4/5 if a position needs to be opened.

Or it simply copies the log once per second to the Files folder, and from there it can be read and analyzed using MQL tools

Thanks.
 
Alexey Kozitsyn:

About the ticks - I agree, but even the indicator, as far as I know, will not solve all problems. To really get all ticks - you need to use CopyTicks() function (for MT5). But there is a problem with it now.

https://www.mql5.com/ru/forum/42122/page17#comment_2835080

If we are talking about MT4 - the indicator is definitely better.

Thank you. I am familiar with this thread, I am re-reading it. Yes. About MT4. I am writing...

I compare the indicator and Expert Advisor readings - everything beats. I have tried it on Eurodollar and Friday - it seems that the speeds are normal and the broker is English Active Traders - do not take it as a reference. I have already implemented the code in my robot. I will use another ticks handling there - I will also look at it and compare... Thank you for your help.

I have to pull it all out of the indicator there too... Perhaps, the part will be done by a direct code in a robot, that will not be critical for ticks, the other part in indicators...

 
Can you please tell me how to fix the fact that the optimization run has ended prematurely due to a loss of the deposit?
Reason: