Hi alltogether,
I'm grateful that there are people always who are willing to help and are giving competent answers to all my questions.
Following problem: I have an object of class CiHigh and I get unexpected values for BufferSize after having called BufferResize with different values:
...
Bobcat
Interesting question. Not sure if it's a feature or a bug. In all case the statement high.BufferResize(200) doesn't really resize the buffer.
I can only suggest you to write to ServideDesk to report this and ask their enlightenment.
Hii,
thank you again for your answer!
I will describe the problem to ServiceDesk and I let you know the answer!
Bobcat
"Happiness is only real when shared"
until now I have no answer from the ServiceDesk. But relax - this is no problem.
I think I have found the cause for the strange buffer size values. Please see the following code extract from Include/Indicators/TimeSeries.mqh:
//+------------------------------------------------------------------+ //| Set size of buffer | //+------------------------------------------------------------------+ bool CPriceSeries::BufferResize(const int size) { if(size>m_buffer_size && !CSeries::BufferResize(size)) return(false); //-- history is avalible CDoubleBuffer *buff=At(0); //--- check pointer if(buff==NULL) return(false); //-- buff.Size(size); //--- ok return(true); }
The and-Expression (marked in red letters) is the problem: in case if size <= m_buffer_size the second expression !CSeries::BufferResize(size) is never called (for compiler optimization strategy I guess). But one side-effect of CSeries::BufferResize is the modification/adaptation of the variable m_buffer_size.
Solutions:
a simple solution is to exchange the order of the both expressions:
if(!CSeries::BufferResize(size) && size>m_buffer_size) return(false);
A better solution would be:
bool bufres = CSeries::BufferResize(size); if(size>m_buffer_size && !bufres) return(false);
What do you think?
A second issue:
I wonder if the initial buffer size of the timeseries buffers is 100. And indeed it is:
In Include/Indicators/Series.mqh there is the following define statement:
#define DEFAULT_BUFFER_SIZE 100
This macro is used during creation of CiHigh Object.
I hope this will clarify some things....
Bobcat
until now I have no answer from the ServiceDesk. But relax - this is no problem.
I think I have found the cause for the strange buffer size values. Please see the following code extract from Include/Indicators/TimeSeries.mqh:
The and-Expression (marked in red letters) is the problem: in case if size <= m_buffer_size the second expression !CSeries::BufferResize(size) is never called (for compiler optimization strategy I guess). But one side-effect of CSeries::BufferResize is the modification/adaptation of the variable m_buffer_size.
Solutions:
a simple solution is to exchange the order of the both expressions:
A better solution would be:
What do you think?
If you want to use your correction, don't forget to use a copy of TimeSeries.mqh, as it can be overwritten during MT5 update.
I already read the code when your reported this problem, so I am aware of what you say now. But it's Metaquotes code for the Standard Library, so it's to them to fix it or say : not it works like intended. This is why I wrote previously : bug or feature ?
If you want to use your correction, don't forget to use a copy of TimeSeries.mqh, as it can be overwritten during MT5 update.
Yes, I see what you mean. Thank you.
Bobcat
-----------------------------------------------------------------------------------
"Computers are good at following instructions, but not at reading your mind."
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi alltogether,
I'm grateful that there are people always who are willing to help and are giving competent answers to all my questions.
Following problem: I have an object of class CiHigh and I get unexpected values for BufferSize after having called BufferResize with different values:
The output is:
Notes/Questions:
Many thanks for each answer!
Bobcat