"Start at 08:00 New York" sounds simple. In MetaTrader it is not: the server clock of your broker is not any real time zone, the USA and Europe change their clocks on different weekends (for 1 - 3 weeks every spring and autumn New York - London is 4 hours instead of 5), the Strategy Tester gives TimeGMT() = TimeLocal() = server time, and TimeGMT() on a live chart is only as good as the time zone of your PC. This package solves it with plain date rules, no web request and no DLL.
Files
What the class knows
Use in an EA
#include <BrokerTime.mqh> CBrokerTime bt; ... bt.DetectFromHistory(_Symbol); // OnInit; false = no history yet MqlDateTime d; TimeToStruct(TimeCurrent(), d); datetime open = bt.ZoneTimeToServer(BT_NEW_YORK, d.year, d.mon, d.day, 8, 30); // 08:30 New York as server time bool newYorkSummer = bt.IsSummerTime(BT_NEW_YORK, bt.ServerToUtc(TimeCurrent())); double hours = bt.DifferenceHours(BT_NEW_YORK, BT_LONDON, bt.ServerToUtc(TimeCurrent())); // -5, or -4 in a gap week
Other calls: UtcToZone(), ZoneToUtc(), ServerToUtc(), UtcToServer(), Convert(from, to, time), OffsetAt(), NextChange(zone, utc) (the next clock change), Abbreviation() (EST, EDT, GMT, BST, CET, CEST, AEDT, AEST, JST), ZoneName(), LiveOffsetSeconds() (live only: server minus GMT from the terminal clocks, as a cross-check).
A local time that does not exist (the skipped hour in spring) is taken with the winter offset; a local time that happens twice (autumn) is taken as the first one, the same rule as Python's zoneinfo with fold = 0.
The indicator
How it was tested
Good to know
Heikin Ashi Candles
A clean Heikin Ashi indicator that draws on the main chart window. It also adds one horizontal line at the average price, (Open + High + Low + Close) / 4, of the last closed candle of a chosen timeframe. By default this is H1, and the line uses the normal candles, not Heikin Ashi.
Smart Money Concepts BOS CHoCH
Market structure indicator for Gold (XAUUSD), EURUSD and any symbol: swing highs and lows with HH HL LH LL labels, BOS and CHoCH drawn on closed candles, alerts and 4 buffers for EAs. Open source code.
Risk Lot Calculator - lot size from your risk and stop (class for EAs + chart panel)
Drag the stop-loss line and read the lot size that risks exactly your money or percent. The CRiskSizer class does the same in an EA: lot rounded down, minimum lot never forced, max lot, volume limit, stop level and margin checked.
Stationarity: KPSS, Phillips-Perron, DF-GLS, Zivot-Andrews and variance ratio tests
Five tests to tell a random walk from a mean-reverting series: KPSS, Phillips-Perron, DF-GLS, Zivot-Andrews with the break date, and the variance ratio.