for( int i=1; i<=10; i++)
Still printing 0
Either declare the size of the array:
double hold_trade[10]; int start() { for( int i=0; i<10; i++) { hold_trade[i] = i; Print(hold_trade[i]); } }
Or re-size it using ArrayResize() before accessing cells that don't exist yet:
double hold_trade[]; int start() { for( int i=0; i<10; i++) { ArrayResize(hold_trade,i+1); hold_trade[i] = i; Print(hold_trade[i]); } }
And next time...
gordon:
Either declare the size of the array:
Or re-size it using ArrayResize() before accessing cells that don't exist yet:
And next time...
Thanks! Now it's working well!
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
Hi all,
I'm trying to do a very simple function, but without success
this is the function:
double hold_trade[];int start()
{
for( int i=0; i<10; i++){
hold_trade[i] = i;
Print(hold_trade[i]);
}
}
This function is printing 0, instead of 1,2,3,4,5,6
Any idea?
Thanks