forked from animatedread/Warrior_EA
- Introduced `FeatureScale.mqh` with `FeatSquash` function for stateless feature scaling. - Added `RegimeMath.mqh` class for regime arithmetic, including efficiency and variance calculations. - Documented the Mind trading logic in `MIND.md`, detailing the trading process and modes. - Created `VOLNORM_PLAN.md` and `VOLNORM_RESULTS.md` for tick-volume normalization testing. - Implemented `read_book.py` for analyzing trade book data and correlations. - Developed `volnorm.py` for testing tick-volume normalization with new and old methods.
41 lines
1.7 KiB
MQL5
41 lines
1.7 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| ModalityCalendar.mqh |
|
|
//| AnimateDread |
|
|
//| |
|
|
//| WHEN IT IS. Day of week, hour, day of month and days to month end |
|
|
//| of the signal bar (broker time, the same clock the bars carry). |
|
|
//| Turn-of-month and weekday effects are the calendar edges equity |
|
|
//| indices are known for; recorded so the journal can say whether |
|
|
//| this book's dips behave differently on them. |
|
|
//+------------------------------------------------------------------+
|
|
#ifndef WARRIOR_MODALITYCALENDAR_MQH
|
|
#define WARRIOR_MODALITYCALENDAR_MQH
|
|
|
|
#include "Modality.mqh"
|
|
|
|
class CModalityCalendar : public CModality
|
|
{
|
|
public:
|
|
virtual string Name(void) const override { return "calendar"; }
|
|
virtual bool Read(const SBarRef &bar, SMarketContext &ctx) override
|
|
{
|
|
MqlDateTime t;
|
|
TimeToStruct(bar.time, t);
|
|
//--- Days to month end from the calendar itself, so leap years need no table.
|
|
MqlDateTime today = t, next = t;
|
|
today.hour = today.min = today.sec = 0;
|
|
next.hour = next.min = next.sec = 0;
|
|
next.day = 1;
|
|
if(++next.mon > 12)
|
|
{
|
|
next.mon = 1;
|
|
next.year++;
|
|
}
|
|
ctx.v[CTX_DOW] = t.day_of_week;
|
|
ctx.v[CTX_HOUR] = t.hour;
|
|
ctx.v[CTX_DOM] = t.day;
|
|
ctx.v[CTX_TO_MONTH_END] = (double)((StructToTime(next) - StructToTime(today)) / 86400) - 1.0;
|
|
return true;
|
|
}
|
|
};
|
|
#endif // WARRIOR_MODALITYCALENDAR_MQH
|