FILE WRITE / FILE READ in Expert code.

 

Hi,

Why the same code works well into a script but it doesn't work in EA even if I make it run one time only through a switch?

if(sswitch==0)
  {  
  int handle;
  double BarOpenValues[10];
 
  for(int i=0;i<10; i++)
    BarOpenValues[i]=Open[i];
  
  handle=FileOpen("mydata.dat", FILE_BIN|FILE_WRITE);
  if(handle>0)
    {
     FileWriteArray(handle, BarOpenValues, 3, 7);
     FileClose(handle);
    }
sswitch=1
  }

sswitch is declared as global int variable as zero.

Thank you very much.

ST

 

I tested your code in EA, it works. Probably you forgot to allow EA in your terminal.

 
Roger wrote >>

I tested your code in EA, it works. Probably you forgot to allow EA in your terminal.

Thank you Roger.

Reason: