CustomTimeframePanelEA - User Guide for MT4 and MT5 Versions: MT5 V6, MT4 V6 1. Purpose CustomTimeframePanelEA creates synthetic charts with custom timeframes: 1S, 5S, 10S, 15S, 30S, 45S 2M, 3M, 4M, 10M, 20M, 45M 2H, 3H, 5H, 6H, 7H, 8H The main purpose is to create a full chart where you can attach indicators, apply templates, and use chart objects. 2. Files For MetaTrader 5: CustomTimeframePanelEA_V6.mq5 For MetaTrader 4: CustomTimeframePanelEA_MT4_V6.mq4 3. Important MT5 and MT4 Difference MT5 uses a custom symbol. The Expert Advisor creates a separate custom symbol, for example: CTF_XAUUSD_2H You can attach indicators and templates to the chart of this custom symbol. MT4 uses an offline chart. The Expert Advisor creates an offline chart, for example: XAUUSD,M120 for 2H XAUUSD,M45 for 45M XAUUSD,M10001 for 1S Indicators and templates must be attached to the opened offline chart. 4. MT5 Installation 1. Open MetaTrader 5. 2. Click File -> Open Data Folder. 3. Open the MQL5/Experts folder. 4. Copy CustomTimeframePanelEA_V6.mq5 into this folder. 5. Open MetaEditor. 6. Find CustomTimeframePanelEA_V6.mq5 and compile it. 7. Return to MT5. 8. Open a normal chart of the required symbol, for example XAUUSD M1. 9. Attach CustomTimeframePanelEA_V6 to this normal chart. 10. Enable Algo Trading. 5. MT5 Usage 1. Attach the EA to a normal chart, for example XAUUSD M1. 2. A timeframe button panel will appear on the chart. 3. Click the required period, for example 2H, 10M, or 5S. 4. The EA will create a custom symbol, for example CTF_XAUUSD_2H. 5. The EA will open a separate chart: CTF_XAUUSD_2H, M1. 6. Attach indicators, templates, and chart objects to the CTF_... chart, not to the original XAUUSD chart. Important: The original MT5 chart is used as a data generator and control panel. The working analysis chart is the CTF_... custom symbol chart. 6. MT4 Installation 1. Open MetaTrader 4. 2. Click File -> Open Data Folder. 3. Open the MQL4/Experts folder. 4. Copy CustomTimeframePanelEA_MT4_V6.mq4 into this folder. 5. Open MetaEditor. 6. Find CustomTimeframePanelEA_MT4_V6.mq4 and compile it. 7. Return to MT4. 8. Open a normal chart of the required symbol, for example XAUUSD M1. 9. Attach CustomTimeframePanelEA_MT4_V6 to this normal chart. 10. Enable AutoTrading. 7. MT4 Usage 1. Attach the EA to a normal chart, for example XAUUSD M1. 2. A timeframe button panel will appear on the chart. 3. Click the required period, for example 2H, 10M, or 5S. 4. The EA will create and open an offline chart. 5. Attach indicators, templates, and chart objects to the opened offline chart. Offline chart examples: 2M -> XAUUSD,M2 10M -> XAUUSD,M10 45M -> XAUUSD,M45 2H -> XAUUSD,M120 8H -> XAUUSD,M480 1S -> XAUUSD,M10001 5S -> XAUUSD,M10005 Important: In MT4, the original chart must remain open because the EA updates the offline chart from that chart. 8. Where to Attach Indicators MT5: Attach indicators to the custom symbol chart, for example CTF_XAUUSD_2H, M1. MT4: Attach indicators to the offline chart, for example XAUUSD,M120 or XAUUSD,M10005. Do not attach indicators to the original chart if you want them to calculate the synthetic timeframe. Indicators on the original chart will use the normal symbol and normal timeframe. 9. Seconds Charts MT5: Seconds charts are built from ticks if the broker provides tick history. MT4: MT4 does not provide a full historical tick API. Seconds charts are built from realtime ticks after the EA starts. At first, the chart may be short or may look like the M1 fallback. After enough ticks are collected, 1S, 5S, 10S, 15S, 30S, and 45S will start to differ. 10. Minutes and Hours Charts MT5: Minutes and hours synthetic charts are built from M1 history. MT4: Minutes synthetic charts are built from M1 history. Hours synthetic charts are built from H1 history to get more bars. If an hourly synthetic chart has only a few candles, open the normal H1 chart for that symbol and scroll back to force MT4 to load more H1 history. 11. Main MT5 V6 Inputs InpTimeframes - list of timeframes on the panel. InpMaxBars - number of synthetic bars. InpCreateIndicatorChart - create a custom symbol chart for indicators. InpOpenIndicatorChartOnSwitch - open the custom chart when switching periods. InpReuseIndicatorChartWindow - reuse one custom chart window. InpApplyTemplateToIndicatorChart - apply a template to the custom chart. InpIndicatorChartTemplate - template file name. InpDrawOverlayChart - draw a synthetic overlay on the original chart. Disabled by default. InpCustomSymbolPrefix - custom symbol prefix, for example CTF. 12. Main MT4 V6 Inputs InpTimeframes - list of timeframes on the panel. InpMaxBars - number of synthetic bars. InpOpenOfflineChartOnSwitch - open the offline chart when switching periods. InpReuseOfflineChartWindow - reuse one offline chart window. InpForceReopenOfflineChartOnSwitch - close the old offline chart and open a new one when switching periods. InpSecondsFallbackFromM1 - use M1 fallback while there are no collected ticks for seconds charts. InpApplyTemplateToOfflineChart - apply a template to the offline chart. InpOfflineChartTemplate - template file name. 13. Templates MT5: Save your template in MT5 as CustomTimeframe.tpl. Set InpApplyTemplateToIndicatorChart = true. Set InpIndicatorChartTemplate = CustomTimeframe.tpl. MT4: Save your template in MT4 as CustomTimeframe.tpl. Set InpApplyTemplateToOfflineChart = true. Set InpOfflineChartTemplate = CustomTimeframe.tpl. 14. Common Issues Issue: The indicator calculates the normal timeframe. Solution: The indicator was attached to the original chart. Attach it to the custom/offline chart. Issue: MT4 seconds periods look similar at first. Solution: Wait for realtime ticks to accumulate. MT4 does not have historical ticks like MT5. Issue: MT4 has only a few candles on 2H/8H. Solution: Open the normal H1 chart for the symbol and load more history. Issue: The MT4 offline chart does not switch. Solution: Enable InpForceReopenOfflineChartOnSwitch = true. Issue: The MT5 custom chart did not open. Solution: Check that InpCreateIndicatorChart is enabled and Algo Trading is allowed. 15. Recommended Workflow MT5: 1. Open a normal XAUUSD M1 chart. 2. Attach CustomTimeframePanelEA_V6. 3. Click the required timeframe. 4. Work on the opened CTF_XAUUSD_..., M1 chart. MT4: 1. Open a normal XAUUSD M1 chart. 2. Attach CustomTimeframePanelEA_MT4_V6. 3. Click the required timeframe. 4. Work on the opened offline chart.