SessionClock

  • librerie
  • Shipra Gupta
    Shipra Gupta
    Sono Shipra Gupta, trader e sviluppatrice di strategie quantitative con una solida formazione in matematica, economia e sistemi di trading algoritmico. Nel corso degli anni ho lavorato ampiamente nei mercati forex, oro, indici, materie prime e criptovalute, concentrandomi sulla costruzione di
  • Versione: 1.0

SessionClock – DST-Aware Broker Clock & Trading Sessions

TimeGMT() returns server time in the Strategy Tester, so most session EAs backtest on the wrong hours around every DST switch. SessionClock fixes that.

Features

  • Auto-detect broker – Fits your broker's GMT offset and DST rule (none, US, EU, AU) to weekend opens in price history. Works in the Strategy Tester.
  • Live fallback – SC_DetectLive() reads TimeTradeServer() − TimeGMT(). SC_SetBroker() for manual override.
  • 7 time zones – UTC, New York, London, Frankfurt, Tokyo, Sydney, Hong Kong, each with its own DST calendar.
  • 7 sessions – Sydney, Tokyo, London, Frankfurt, New York, NY cash 09:30–16:00, London/NY overlap.
  • Countdowns – Next session open in server time and minutes until it opens.
  • Trading day – 17:00 New York rollover key used by FX and index CFDs.

Quick start

1. Buy and download the library. MetaTrader installs it to MQL5\Libraries\SessionClock.ex5.
2. Paste the import block below at the top of your EA, indicator or script.
3. Call the functions.

int OnInit()
  {
   if(!SC_DetectFromHistory("EURUSD",17,104)) SC_SetBroker(120,SC_DST_US);
   Print(SC_Describe());              // Broker GMT+2.0, DST US, fit 100%
   return(INIT_SUCCEEDED);
  }
void OnTick()
  {
   if(SC_IsSessionOpen(SC_SES_NY_CASH,TimeCurrent())) Trade();
  }

Import block (copy into your code)

#define SC_DST_NONE    0
#define SC_DST_US      1
#define SC_DST_EU      2
#define SC_DST_AU      3
#define SC_ZONE_UTC        0
#define SC_ZONE_NEWYORK    1
#define SC_ZONE_LONDON     2
#define SC_ZONE_FRANKFURT  3
#define SC_ZONE_TOKYO      4
#define SC_ZONE_SYDNEY     5
#define SC_ZONE_HONGKONG   6
#define SC_ZONE_SERVER     7
#define SC_SES_SYDNEY      0
#define SC_SES_TOKYO       1
#define SC_SES_LONDON      2
#define SC_SES_NEWYORK     3
#define SC_SES_NY_CASH     4
#define SC_SES_LDN_NY      5
#define SC_SES_FRANKFURT   6
#define SC_ERR_NONE    0
#define SC_ERR_PARAM   1
#define SC_ERR_DATA    2
#define SC_ERR_SYMBOL  3
#define SC_ERR_FIT     4

#import "SessionClock.ex5"
int SC_LastError();
bool SC_SetBroker(const int base_offset_minutes,const int dst_model);
bool SC_DetectFromHistory(const string symbol,const int ny_open_hour,const int weeks);
bool SC_DetectLive();
double SC_FitScore();
int SC_BrokerBaseMin();
int SC_BrokerDSTModel();
bool SC_IsReady();
int SC_ServerOffsetMin(const datetime server_time);
datetime SC_ServerToUTC(const datetime server_time);
datetime SC_UTCToServer(const datetime utc);
datetime SC_UTCToZone(const datetime utc,const int zone);
datetime SC_ZoneToUTC(const datetime local,const int zone);
datetime SC_ServerToZone(const datetime server_time,const int zone);
datetime SC_ZoneToServer(const datetime local,const int zone);
bool SC_IsDST(const int dst_model,const datetime utc);
bool SC_IsSessionOpen(const int session,const datetime server_time);
datetime SC_NextSessionOpen(const int session,const datetime server_time);
int SC_MinutesToSessionOpen(const int session,const datetime server_time);
datetime SC_TradingDay(const datetime server_time,const int ny_roll_hour);
string SC_ZoneName(const int zone);
string SC_Describe();
#import

Notes

  • Use any 24/5 reference symbol. FX majors open 17:00 New York; most index CFDs open 18:00.
  • Tested on a GMT+2/+3 New-York-close broker feed: 105 of 105 weekend opens matched.
  • The reference symbol is an input, never hard-coded.

Technical

  • Pure MQL5. No DLL, no WebRequest, no file I/O.
  • Every exported function validates its inputs. SC_LastError() returns the reason for any failed call.
  • Works in the Strategy Tester and live, on any broker, symbol and account currency.

Past performance shown in screenshots is from historical data and does not guarantee future results.



Altri dall’autore
AMD Po3
Shipra Gupta
AMD Po3 for MetaTrader 5 Accumulation, manipulation, distribution: mapped for you. AMD Po3 is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator maps the reaction zones that matter right now: the nearest areas above and
KN Smart TP SL Signals — Incrocio EMA + TP/SL Smart KN Smart TP SL Signals è un indicatore pulito di incrocio EMA per MetaTrader 5 che trasforma ogni incrocio confermato in un setup operativo visivo completo: Entry → Stop Loss → TP1 → TP2 → TP3 Non è necessario calcolare manualmente i livelli. Logica principale La Fast EMA incrocia sopra la Slow EMA → Acquisto La Fast EMA incrocia sotto la Slow EMA → Vendita I segnali vengono confermati sulle candele chiuse , evitando segnali generati dalla can
IFVG Sniper Entry Engine — Descrizione per il Marketplace MQL5 IFVG Sniper Entry Engine è un indicatore MT5 di precisione sviluppato attorno a uno dei modelli di ingresso più specifici e ad alta probabilità di Smart Money Concepts: l'Inverse Fair Value Gap (IFVG). Monitora silenziosamente ogni Fair Value Gap grezzo formato sul grafico, controlla ciascuno di essi per verificarne l'inversione (mitigazione) e, nel momento in cui viene confermato un IFVG valido, emette un segnale di ACQUISTO (BUY) o
Coppock Curve MultiFilter for MetaTrader 5 The classic Coppock curve with modern filters. Coppock Curve MultiFilter is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with
FREE
Tension Flow Trend — Nastro HMA Dinamico con Backtest Storico RR Tension Flow Trend è un indicatore di trend-following avanzato per MetaTrader 5 che combina un nastro di tendenza basato sulla Media Mobile di Hull (HMA), un'analisi del momentum Z-Score e un motore di backtesting visivo del rapporto Rischio:Rendimento (Risk:Reward) integrato in un unico overlay sul grafico. Progettato per identificare opportunità di continuazione del trend ad alta probabilità, l'indicatore filtra il rumore del mer
FREE
Adaptive RSI Supertrend for MetaTrader 5 Trend and RSI momentum in one view. Adaptive RSI Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
FREE
Trend Target Ribbon [BOSWaves] Trend Target Ribbon [BOSWaves] , MetaTrader 5 (MQL5) için geliştirilmiş gelişmiş ve çok yönlü bir trend takip ve risk yönetimi göstergesidir. Pürüzsüzleştirilmiş Arnaud Legoux Moving Average (ALMA) çekirdeğini volatilite ve eğim tabanlı doğrulama filtreleriyle birleştirerek piyasa trendlerini, renk kodlu dinamik ribbon'ları ve otomatik çok seviyeli Risk-to-Reward ($R$) işlem projeksiyonlarını gösterir. Temel Özellikler 1. ALMA Trend Ribbon ve Eğim Filtreleme ALMA S
FREE
Structure-Anchored VWAP [WAT] Structure-Anchored VWAP [WAT] è un indicatore VWAP per MetaTrader 5 basato sulla struttura del mercato. Ancora il VWAP a swing e punti strutturali significativi invece di affidarsi esclusivamente a reset fissi della sessione. Combina Struttura di Mercato + Anchored VWAP + Bande di Deviazione + Segnali di Retest + Gestione del Trade basata su ATR in un unico framework visivo. Caratteristiche principali 3 modalità di ancoraggio — Swing, Structure e Fast Rilevament
FREE
Liquidity Intelligence System — Descrizione per il Marketplace MQL5 Liquidity Intelligence System è un indicatore MT5 di livello istituzionale che mappa i pool di liquidità dello Smart Money, rileva le configurazioni di caccia alla liquidità e inversione (sweep-and-reverse) e genera segnali di trading ad alta confluenza attraverso 16 modelli di segnale testabili in modo indipendente, il tutto all'interno di un unico indicatore pulito. Come Funziona Il motore costruisce continuamente una mappa de
Precision Sniper Trader Precision Sniper Trader è un indicatore professionale di trend-following e conferma del momentum, progettato per i trader che desiderano un'esecuzione pulita sui grafici, ingressi ad alta probabilità e una gestione strutturata delle operazioni nei mercati Forex, Oro, Indici e Criptovalute. Sviluppato con un approccio in stile "sniper" (cecchino), l'indicatore combina l'analisi del trend basata su EMA, la conferma del momentum, target dinamici basati sull'ATR e un filtragg
FREE
TrendIQ Pro for MetaTrader 5 Adaptive volatility trend with a trend cloud. TrendIQ Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull colour for long
INDICATORE SQUEEZE MOMENTUM BREAKOUT MT5 Sistema di Trading Professionale di Compressione della Volatilità e Breakout del Momentum per MetaTrader 5 Squeeze Momentum Breakout è un indicatore di breakout di livello professionale per MT5 progettato per rilevare movimenti di mercato esplosivi dopo periodi di consolidamento a bassa volatilità. Sviluppato per scalper, trader intraday e momentum trader, l'indicatore combina la compressione della volatilità, la conferma del momentum, il filtraggio dei v
FREE
INDICATORE VOLUME BREAKOUT PRO MT5 Sistema di Trading Professionale di Espansione del Volume e Breakout per MetaTrader 5 Volume Breakout Pro è un indicatore di breakout di livello istituzionale sviluppato specificamente per la piattaforma MetaTrader 5. Progettato per scalper, day trader e momentum trader, il sistema si concentra sull'identificazione di movimenti di prezzo esplosivi guidati da un'espansione anomala del volume e da uno squilibrio di liquidità. L'indicatore combina: Logica dell'Osc
FREE
Meridian Flow — Indicatore Smart Money Structure per MT5 Meridian Flow è un indicatore per MetaTrader 5 progettato per i trader che utilizzano Smart Money Concepts (SMC) e la metodologia ICT Price Action . Rileva automaticamente gli eventi BOS (Break of Structure) e CHoCH (Change of Character) su qualsiasi strumento e timeframe, quindi traccia una mappa completa del rischio — Entry, Stop Loss, TP1, TP2 e TP3 — per ogni segnale, inclusi quelli storici. I segnali vengono generati esclusivamente s
Adaptive Trend System for MetaTrader 5 A trend line that adapts to volatility. Adaptive Trend System is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
Market Path Forecast for MetaTrader 5 Projected price paths from swing statistics. Market Path Forecast is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how price b
FREE
RSI Signal Entries for MetaTrader 5 RSI extremes plus candle confirmation. RSI Signal Entries is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with clear extreme zones.
FREE
Trident Swing Projector for MetaTrader 5 Quarter-swing projections from ABC structures. Trident Swing Projector is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how
Z-Score Range Boxes Breakout for MetaTrader 5 Statistical extremes boxed, breakouts flagged. Z-Score Range Boxes Breakout is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator tracks the range or channel price is tradin
Precision Sniper Pro for MetaTrader 5 Four pillars: EMA, RSI, MACD and ADX. Precision Sniper Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator watches for its signal condition and waits for the candle to close b
FREE
Stealth Trail Supertrend for MetaTrader 5 A supertrend that adapts its own multiplier. Stealth Trail Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the tre
Fibonacci Path Profile for MetaTrader 5 How price moved after similar retracements. Fibonacci Path Profile is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how pric
Strong Fade Signals for MetaTrader 5 Fade the overextended move, with a score. Strong Fade Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator watches for its signal condition and waits for the candle to close
FREE
Fan Principle Signals for MetaTrader 5 The classic fan principle, as clear signals. Fan Principle Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how price
McGinley Dynamic Fusion for MetaTrader 5 McGinley Dynamic crossovers with ATR levels. McGinley Dynamic Fusion is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend
Liquidity Entry Signals for MetaTrader 5 Entries where liquidity gets taken. Liquidity Entry Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator maps the reaction zones that matter right now: the nearest areas
Cardwell Range Pro for MetaTrader 5 RSI ranges that change with the market regime. Cardwell Range Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with clear extreme
Adaptive RSI Supertrend for MetaTrader 5 Trend and RSI momentum in one view. Adaptive RSI Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
Market Structure Target Tracker for MetaTrader 5 Swings, BOS, CHoCH and ATR targets. Market Structure Target Tracker is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and track
Smart TrendFlow Pro for MetaTrader 5 Channel breaks with a volatility heatmap. Smart TrendFlow Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator tracks the range or channel price is trading in and highlights per
Filtro:
Nessuna recensione
Rispondi alla recensione