//+------------------------------------------------------------------+
//| generateHTML.mq4 |
//| banderassa@ukr.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Antonio Banderass. All rights reserved"
#property link "banderassa@ukr.net"
#property library
//----
int htmlFileHandle=-1;
//+------------------------------------------------------------------+
//| CreateHtmlFile |
//+------------------------------------------------------------------+
int CreateHtmlFile(string fileName, string title, string style =
"styles/default.css")
{
int handle = FileOpen(fileName, FILE_CSV|FILE_WRITE, " ");
if(handle > 0)
{
htmlFileHandle = handle;
FileWrite(handle,
"
", title,
"",
"", title,
"
");
}
else
Print("generateHTML library: error while creating html file");
return (handle);
}
//+------------------------------------------------------------------+
//| CloseHtmlFile |
//+------------------------------------------------------------------+
void CloseHtmlFile()
{
if(htmlFileHandle > 0)
{
FileWrite(htmlFileHandle, "");
FileClose(htmlFileHandle);
}
}
//+------------------------------------------------------------------+
//| WriteMsg |
//+------------------------------------------------------------------+
void WriteMsg(string text, string style = "text")
{
FileWrite(htmlFileHandle, "", text, "");
}
//+------------------------------------------------------------------+
//| WriteMsgLn |
//+------------------------------------------------------------------+
void WriteMsgLn(string text, string style = "text")
{
FileWrite(htmlFileHandle, "", text, "
");
}
//+------------------------------------------------------------------+
//| WriteMsgTime |
//+------------------------------------------------------------------+
void WriteMsgTime(string text, string style = "text")
{
FileWrite(htmlFileHandle, "" + TimeToStr(CurTime()) +
": ", text, "");
}
//+------------------------------------------------------------------+
//| WriteMsgTimeLn |
//+------------------------------------------------------------------+
void WriteMsgTimeLn(string text, string style = "text")
{
FileWrite(htmlFileHandle, "" + TimeToStr(CurTime()) +
": ", text, "
");
}
//+------------------------------------------------------------------+