Good day Apprentice,
I would like to ask if you can include the following below to the attached ea.
News Filter
Time filter with time for each day
Maximum Drawdown % for a day
Maximum Profit for a day
Thanks a lot.
Moderator: admin
//-----------------------------------------------------------------------------------------------
void ReadFileHst(string FileName)
{
int j = 0;
;
string strFileContents;
int Handle;
int LogFileSize;
int movehigh[1] = {0};
uchar buffer[];
int nNumberOfBytesToRead;
int read[1] = {0};
int i;
double mm;
//----- -----
strFileContents = "";
Handle = CreateFileW(FileName, (int)0x80000000, 3, 0, 3, 0, 0);
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
if (Handle == -1) {
Comment("");
return;
}
LogFileSize = GetFileSize(Handle, 0);
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
if (LogFileSize <= 0) {
return;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
if ((LogFileSize - 148) / 60 == BytesToRead) {
return;
}
SetFilePointer(Handle, 148, movehigh, 0);
BytesToRead = (LogFileSize - 148) / 60;
ArrayResize(data, BytesToRead, 0);
nNumberOfBytesToRead = 60;
ArrayResize(buffer, 60, 0);
for (i = 0; i < BytesToRead; i = i + 1)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
{
ReadFile(Handle, buffer, nNumberOfBytesToRead, read, NULL);
if (read[0] == nNumberOfBytesToRead) {
result = StringFormat("0x%02x%02x%02x%02x%02x%02x%02x%02x", buffer[7], buffer[6], buffer[5], buffer[4], buffer[3], buffer[2], buffer[1], buffer[0]);
m_price.buffer[0] = buffer[32];
m_price.buffer[1] = buffer[33];
m_price.buffer[2] = buffer[34];
m_price.buffer[3] = buffer[35];
m_price.buffer[4] = buffer[36];
m_price.buffer[5] = buffer[37];
m_price.buffer[6] = buffer[38];
m_price.buffer[7] = buffer[39];
mm = m_price.close;
data[j][0] = StringToDouble(result);
data[j][1] = mm;
j = j + 1;
strFileContents = TimeToString(StringToTime(result), 3) + " " + DoubleToString(mm, 8);
} else {
CloseHandle(Handle);
return;
}
}
CloseHandle(Handle);
strFileContents = DoubleToString(data[j - 1][0], 3) + " " + DoubleToString(data[j - 1][1], 8) + " " + DoubleToString(data[j - 2][1], 3) + " " + DoubleToString(data[j - 2][1], 8);
result = strFileContents;
}
// ReadFileHst <<==-------- --------
int fnGetLotDigit()
{
double l_LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
if (l_LotStep == 1)
return (0);
if (l_LotStep == 0.1)
return (1);
if (l_LotStep == 0.01)
return (2);
if (l_LotStep == 0.001)
return (3);
if (l_LotStep == 0.0001)
return (4);
return (1);
}
//+------------------------------------------------------------------+
Return to Indicator and Signal Requests
Users browsing this forum: Bing [Bot] and 39 guests