FileWrite() inside OnTick() function

 

Hi,

In my EA testing, I want to write all Buy and sell events in a file. Here is what I did, But it is writing only one line instead of two or more. FileWrite() inside OnTick() funstion is not being executed.

Any suggestion?

Thanks.

int handle = FileOpen("OrdersReport.csv", FILE_WRITE|FILE_CSV, "\t");

int OnInit()

{ if(handle==INVALID_HANDLE) return(0); FileWrite(handle, "open price", "open time", "symbol", "lots");

}

void OnDeinit(const int reason) { FileClose(handle); }

void OnTick()

{ FileWrite(handle, "open price", "open time", "symbol", "lots"); // writing the same line just to test

}

Reason: