add support for XSymbolSessionParser in commons lib ...
This commit is contained in:
@@ -5577,6 +5577,66 @@ struct XSymbolParser
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
struct XSymbolSessionParser
|
||||
{
|
||||
//
|
||||
string version; // Temp ...
|
||||
|
||||
//
|
||||
// Check Market Is Open for Specific Symbol
|
||||
// in Current Time ...
|
||||
bool CanTrade(
|
||||
string symbol // Trading Symbol
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid(symbol);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
MqlDateTime timeStruct;
|
||||
result = TimeCurrent(timeStruct);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_DAY_OF_WEEK dayOfWeek = (ENUM_DAY_OF_WEEK) timeStruct.day_of_week;
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
datetime from;
|
||||
datetime to;
|
||||
result = SymbolInfoSessionTrade(
|
||||
symbol,
|
||||
dayOfWeek,
|
||||
0, // Session Index ...
|
||||
from,
|
||||
to //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = cTime > from && cTime < to;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Styling Buffers ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user