Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 186
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
As you can see - there are ten orders, but their indexes are 1 less, because in any array the count starts from zero.
OrdersTotal() is 10, but if you start a loop with OrdersTotal(), it will go outside the array - there is no index for order 10 - the largest index is 9 - so OrdersTotal()-1
Thank you ... Got it ... Thank you.
This is because it is counted from 0. If you have 10 orders, then count ordinal numbers should be 0...9, that is, 0...(10-1), whereOrdersTotal()=10.
Just keep this in mind when writing programs.
Thank you ... got it ...
Print via Print() and you won't have these questions, it's not difficult.
Thanks ... Got it ... I just thought theOrdersTotal count was also including zero ... Then I was wrong, I wrote like this(int i=OrdersTotal(); i>-1; i--) and it didn't work properly.
In the documentation, in the article "Indicator Styles in Examples" it says :
By default, the indicator buffer is used to store the data to be drawn (INDICATOR_DATA).
If the calculation of indicator values requires intermediate calculations and storing an auxiliary value for each bar, you can declare such an array as a calculation buffer ( INDICATOR_CALCULATIONS) when binding.
None of 18 given examples of constructions in MQL5 demonstrates thearray of calculation buffer ( INDICATOR_CALCULATIONS).Please advise where else to read about this topic ?
Hello!
In the documentation, in the article "Indicator Styles in Examples" it says :
By default, the indicator buffer is used to store the data to be drawn (INDICATOR_DATA).
If the calculation of indicator values requires intermediate calculations and storing an auxiliary value for each bar, you can declare such an array as a calculation buffer ( INDICATOR_CALCULATIONS) when binding.
None of 18 given examples of constructions in MQL5 demonstrates thearray of calculation buffer ( INDICATOR_CALCULATIONS).Please tell me where else to read about it ?
Think of it as a normal dynamic array for storing intermediate calculations. You just do not need to control it and increase/decrease its size - the terminal will do it for you. The data of such an array-buffer will not be shown on a chart - that's the difference between DATA and CALCULATIONS.
Think of it as a normal dynamic array for storing intermediate calculations. You just do not need to control it and increase/decrease its size - the terminal will do it for you. The data of such an array-buffer will not be printed on a chart - this is the difference between DATA and CALCULATIONS
Where's a working code example for clarity?
And the one you gave.... For example line 87 : maHandle=iMA(Symbol(),0,ExtPeriod,0,MODE_EMA,PRICE_CLOSE);
Well, what does it matter?