Hi,
I try to compile this code:
The compilator say 'Series' - undeclared identifier, but I declared in IF..
If a write out of IF run ok but if a declere variable in IF, compilator don't understand declaration...
I need to declare diferents variables types according of Copy function result.
I think maybe is one bug of compilator?
Thanks,
Andrei Darie
It's not a bug. If you are declaring a variable inside a block of code, it's local to this block.
I need to declare diferents variables types according of Copy function result.
It's not clear, what are you trying to do ?
Hi I will create one function to copy bars Propierties (Time,Close,Open,high,low,volume) to en extern Struct.
Now I know the declaration variable in if is only to this block. I can correct my code and write all in if sentence.
....... ArrayResize(BarsBuffer[1].bar,10); int copied; int exec; if(tocopy=="Time"){ datetime Series[]; ArraySetAsSeries(Series,true); copied=CopyTime(Symbol(),1,0,10,Series); int size=ArraySize(Series); for(int i=size-1;i>=0;i--) { BarsBuffer[1].bar[i].volumen = Series[i]; } } if(tocopy=="Close"){ double Series[]; ArraySetAsSeries(Series,true); copied=CopyClose(Symbol(),1,0,10,Series); int size=ArraySize(Series); for(int i=size-1;i>=0;i--) { BarsBuffer[1].bar[i].volumen = Series[i]; } } ......
I will create one function for exemple:
void copytobarsbuffer(string tocopy, ENUM_TIMEFRAMES timeframe, int numberbars );
Trough tocopy parameter I can indicate what I will copy. (High,Low, Volume,....)
Thanks for help !
Andrie Darie
- 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 try to compile this code:
The compilator say 'Series' - undeclared identifier, but I declared in IF..
If a write out of IF run ok but if a declere variable in IF, compilator don't understand declaration...
I need to declare diferents variables types according of Copy function result.
I think maybe is one bug of compilator?
Thanks,
Andrei Darie