BarInfoStruct BarInfo[]; ... int OnInit() { ... ArrayResize(BarInfo,MaxBars); ... }

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
I declared integer :
input int MaxBars=100;
and structure:
struct BarInfoStruct
{double Medium;
double Speed;
int Weight;};
Now I want to use that integer in declaring structure array:
BarInfoStruct BarInfo[MaxBars]; (- incorrect declaring, gives error)
and of course for cycling through that array
For (int i=0;i<MaxBars;i++) {
BarInfo[i].Weight=0;}
Problem is that for cycling is possible to use that declared MaxBars but not for declaring BarInfo size. Is there intelligent way for declaring both array size and index running limit?