return expressions are not allowed on a global basis
Ovo:
The function declares int type, while you return void.
return 0; would fix it.
in brackets? return(0) returns the same error unfortunately
int start() { write_data(); } return(0);
ydrol:
Error means return must be inside the function not outside
Error means return must be inside the function not outside
Indeed.
Thanks for your help
Hi Guys,
still struggling with this. Here is the complete code. What exactly do I need to change? Your help is very much appreciated
extern int size = 50; //---- void write_data() { //---- if (size==0) return; int handle=FileOpen("DATA_TEST.csv",FILE_WRITE|FILE_CSV,','); if (handle<0) return; FileWrite(handle," ,EURUSD, EURUSD, EURUSD, EURUSD"); FileWrite(handle,"DATE,OPEN, HIGH, LOW, CLOSE"); for (int i=0;i<=size;i++) { FileWrite(handle,TimeToStr(iTime("EURUSD",PERIOD_D1,i),TIME_DATE), iOpen("EURUSD",PERIOD_D1,i), iHigh("EURUSD",PERIOD_D1,i), iLow("EURUSD",PERIOD_D1,i), iClose("EURUSD",PERIOD_D1,i)); } FileClose(handle); } return; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { write_data(); } return(0); //+------------------------------------------------------------------+
theHeiko:
Hi Guys,
still struggling with this. Here is the complete code. What exactly do I need to change? Your help is very much appreciated
You have already been told, is it not clear ?
ydrol:
Error means return must be inside the function not outside
Error means return must be inside the function not outside
obviously not. otherwise I wouldn't have posted this
Thanks Raptor. That makes it clearer
Hi,
since the latest upgrade to build 600 I am getting the "return - expressions are not allowed on a global basis" error. Any idea why that happens?