|
Denver CO USA
Posts: 32 since Sep 2016
Thanks Given: 0
Thanks Received: 13
|
Probably not, but I wrote something similar. easy to write. really. Just from memory.
Just use 3 arrays
double Bids[100];
double Asks[100];
uint TickCounts[100];
int iIndex = 0;
OnTick()
{
StoreTick(Bid, Ask, GetTickCount());
}
StoreTick(double b, double a, uint t)
{
if (iIndex == 100)
DumpPrices();
Bids[iIndex] = b;
Asks[iIndex]= a;
TickCounts[iIndex] = t;
iIndex++;
}
DumpPrices()
{
string fileName = Symbol()+"_"+TimeToStr(TimeCurrent(), TIME_DAY)+".csv"
ResetLastError();
int file_handle=FileOpen(fileName, FILE_READ|FILE_WRITE|FILE_CSV);
if(file_handle!=INVALID_HANDLE)
{
FileSeek(file_handle, 0, SEEK_END);
for(int i=0;i<iIndex;i++)
{
Print(NormalizeDoublt(Bids[i],Digits),NormalizeDouble(Asks[i],Digits),TickCounts[i]);
}
//--- close the file
FileClose(file_handle);
PrintFormat("Data is written, %s file is closed",fileName);
}
void OnDeinit(const int reason)
{
DumpPrices();
}
|