add support for XSymbolSessionParser in commons lib ...

This commit is contained in:
2024-08-08 11:03:50 +03:30
parent ea7b268646
commit d199960cba
+60
View File
@@ -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 ...