NY Close Candles for MT4/MT5: Consistent H4/D1 Charts Across All Brokers
Info
The NY Close Candles for MT4/MT5: Consistent H4/D1 Charts Across All Brokers is a Indicator for MetaTrader 5 that understanding candle timing is crucial for trading strategies that rely on specific chart closes, such as h4 or d1 candles. Different brokers use different server times (UTC offsets), leading to variations in when these candles open and close.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Indicators folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use NY Close Candles for MT4/MT5: Consistent H4/D1 Charts Across All Brokers
1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.
2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.
3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.
4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.
Frequently Asked Questions
Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."
Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).
Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.
What this tool does
Understanding candle timing is crucial for trading strategies that rely on specific chart closes, such as H4 or D1 candles.
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.
Description & Settings
Related: Envelopes Trend Candles: Advanced Trend Filtering for MT5 - another powerful indicator for MetaTrader 5 traders.
Understanding candle timing is crucial for trading strategies that rely on specific chart closes, such as H4 or D1 candles. Different brokers use different server times (UTC offsets), leading to variations in when these candles open and close. This inconsistency can cause Expert Advisors (EAs) to trade differently across various platforms, as indicators like moving averages or ATR will produce different values based on the broker's server time.Also recommended: Closed Bar Alert Example for Developers - similar indicator with strong performance on MetaTrader 5.
Many forex and gold brokers operate on the New York (NY) close time, which is typically UTC+2 or UTC+3 during daylight saving. However, not all brokers adhere to this standard.
This tool generates H4 and D1 candles based on the NY close time, using existing H1 bars. This ensures that your H4 and D1 candles are consistent, regardless of your broker's server time. For brokers already using NY close times, the generated candles will match the native MT5 candles.
The LS_ClockInit function intelligently detects the server clock.
It retrieves live time from TimeTradeServer() - TimeGMT(), rounded to the nearest hour.
In the Strategy Tester, TimeGMT() is not usable, so you can manually select the desired clock (defaulting to NY close).
The tool recognizes NY close, Central European Time (UTC+1/+2), and any fixed UTC offset.
Example Usage:
LS_NYBars bars;
bars.Init(_Symbol, PERIOD_D1); // OnInit, loads H1 history
if(bars.Update()) { ... } // OnTick, returns true when a candle has just closed
bars.Close(1), bars.High(1) ... // shift 1 refers to the last closed candle
bars.TimeNY(1) // open time based on the NY clock
bars.Closes(arr, 200) // provides closes as an array for custom indicator development
This functionality supports H2, H3, H4, H6, H8, H12, and D1 timeframes. Candles are formed using only available H1 bars; weekends and holidays are not filled. A candle is considered closed when the first H1 bar of the subsequent candle opens.
The included demo EA is designed for demonstration purposes and does not open trades. It displays the detected server clock, compares the broker's last candle with the NY close candle, and provides a notification each time a new candle closes. The accompanying screenshot illustrates this: it shows the same XAUUSD tick data on both a NY close server and a CET server within the Strategy Tester. On the CET server, the native MT5 H4 candles differ, while the candles generated by LS_NYBars align with the NY close server. The minor discrepancy observed is due to the differing spreads of the two test symbols.
You may also like: Heikin Ashi Candles as a Chart Overlay - excellent alternative for indicator users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#include "LS_NYBars.mqh"
input LS_CLOCK InpClock = LS_CLOCK_AUTO;
input int InpFixedUTC = 0;
input ENUM_TIMEFRAMES InpTF = PERIOD_D1;
input int InpShow = 5;
LS_NYBars g_bars;
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.