this is the getData method from this class.
//Gets the element of timeseries by starting position and number. int GetData( int start_pos, // starting position int count, // number double& buffer // array ) const
I want to know how many elements are there already so that I can pass it to the count parameter. what is the best way of doing that?
I rewrote the code as below:
#include <Indicators\TimeSeries.mqh> void OnStart() { CiOpen op; op.Create(_Symbol,PERIOD_CURRENT); op.Refresh(); int starPosition = 0; int count = 1; // what is the best way to find out maximum value that can be put inside count variable? double openPricesArray[]; // here is the GetData documentaion: Gets the element of timeseries by starting position and number. int result = op.GetData(starPosition,count,openPricesArray); }
this is the getData method from this class.
I want to know how many elements are there already so that I can pass it to the count parameter. what is the best way of doing that?
I rewrote the code as below:
hi again
I'm not sure whether I should post this question as a new thread or just post it here. I post it here anyway.
I'm really confused with this CiOpen class (and standard library). I can't figure it out what is exactly happening inside these classes. I think MetaQuotes should provide much more documentation for standard library source codes and provide examples of working with these classes. I would really appreciate if anybody can make videos or write articles about MQL5 standard library classes and shed some light on the internals of these classes. I've read a few articles here about standard classes, but they were not that much helpful.
so, lets take a look at the code I've written
#include <Indicators\TimeSeries.mqh> void OnStart() { CiOpen op; op.Create(_Symbol,PERIOD_CURRENT); op.Refresh(); int index; double openPrice_Max_Value = op.MaxValue(0,1024,index); double normilized = NormalizeDouble(openPrice_Max_Value,5); printf("openPrice Max Value is: %f which is at bar %d", normilized,index); }
so for example if there are 1500 bars on the chart, and the bar 1499 has the highest open price, and I put 1500 in the above code( instead of 1024), the index value wont be 1499. (it only finds the index of highest open price index within the range of 0 to 1024)
finally I want to thank Mr Verleyen that answers most of these questions on this forum
hi again
I'm not sure whether I should post this question as a new thread or just post it here. I post it here anyway.
This thread is fine as it's the same topic.
I'm really confused with this CiOpen class (and standard library). I can't figure it out what is exactly happening inside these classes. I think MetaQuotes should provide much more documentation for standard library source codes and provide examples of working with these classes. I would really appreciate if anybody can make videos or write articles about MQL5 standard library classes and shed some light on the internals of these classes. I've read a few articles here about standard classes, but they were not that much helpful.
so, lets take a look at the code I've written
this code works well when there is only 1024 bars in the chart and gives us correct output. but if the number of bars on the chart exceed 1024, It returns wrong index.
You didn't define the size of the collected data, so by default it's 1024.
You can change it with BufferResize().
op.Create(_Symbol,PERIOD_CURRENT); op.BufferResize(2000); op.Refresh();
finally I want to thank Mr Verleyen that answers most of these questions on this forum
- 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 I wrote this code:
the output is :
buffers total: 0
my question is , shouldn't it be 1?? because we have at least 1 buffer