![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
double Signal_Stochastic[];
You declare your array, but you don't size it
You declare your array, but you don't size it
It might not the problem as I have seen many code with such declaration.
Yet if you feel it's wrong, please show the right one. Thanks
It might not the problem as I have seen many code with such declaration.
Yet if you feel it's wrong, please show the right one. Thanks
There is nothing wrong "with such declaration". The problem, is you didn't size it later. Either explicitly, or automatically as a indicator buffer. Look again at your " I have seen many code"
Ok, what I have understood so far by the Array things:
At Line 1(L-1): I have declared an array called 'Signal_Stochastic' with indefinite array size.
At L-2: Used AraySetAsSeries() function for Right to Left counting.
At L-3: Defined the Signal_Stochastic Array with a size of 'i' where 'i' keeps increasing from '0' to last bar available. The value of Signal Line of the Stochastic is getting calculated at every bar starting from the current bar to backward.
At L-4: Define Here this MA is getting fed from the Signal Line of Stochastic. But calculating Value of MA only for current bar.
At L-5: Tried to see the value of Signal Line for current bar.
But I know I have faults in understanding the code.
It might not the problem as I have seen many code with such declaration.
Yet if you feel it's wrong, please show the right one. Thanks
Try this script and notice that #propertystrict has been commented out. This is because an array out of range error is a critical error if #propertystrict is enabled
All the alerts will show zero
Add this single line of code to Resize the array
ArrayResize(Signal_Stochastic,array_size);
And you will see that the Alerts are as expected
If you un-comment #property strict, you will see the alerts as doubles
Ok, what I have understood so far by the Array things:
At Line 1(L-1): I have declared an array called 'Signal_Stochastic' with indefinite array size.
At L-2: Used AraySetAsSeries() function for Dynamic object of the Array.
At L-3: Defined the Signal_Stochastic Array with a size of 'i' where 'i' keeps increasing from '0' to last bar available. The value of Signal Line of the Stochastic is getting calculated at every bar starting from the current bar to backward.
At L-4: Define Here this MA is getting fed from the Signal Line of Stochastic. But calculating Value of MA only for current bar.
At L-5: Tried to see the value of Signal Line for current bar.
But I know I have faults in understanding the code.
asff
But nowhere have you sized the array
But nowhere have you sized the array
Actually I 'm trying to Figure out this 'Array Sizing' thing. If there is any reference with example please give tat link. Thanks
No Luck yet. :(
couldn't find any satisfactory example.
No Luck yet. :(
couldn't find any satisfactory example.
I have already given you an example 4 posts back