The code is full of comments for better understanding. This Description explains the main idea, and the ways to use/reuse the code. This framework consists of three key components:1. CalendarRetriever.mq5 (Script) – This script fetches past economic news events and saves them to files in the "Common" folder of your terminal. These files will later be read by the expert advisor during backtesting. The script requires two input parameters:
Run the CalendarRetriever Script: Select the Symbol you'd like to backtest and run the CalendarRetriever.mq5 script, with the specified start and end date.
The Expert Advisor
Backtest the Strategy Open the Strategy Tester in MetaTrader 5, Select NewsBacktest.mq5 and Run the Backtest in Visual Mode
This framework is designed to be flexible, allowing traders to develop their own strategies around economic news events. Here are some ways you can modify it:
This solution makes backtesting news-based strategies as realistic as possible within the limitations of MetaTrader 5. By first retrieving historical news data and then simulating its impact on the market, traders can gain valuable insights into how their strategies would perform in live conditions.

Smart Trend Follower
This EA is designed to automatically follow market trends using signals from the Moving Average and Stochastic Oscillator indicators. The EA detects buy and sell signals by utilizing MA crossovers and confirms the trend with Stochastic. Additionally, the EA includes automatic position management, such as setting Take Profit, Stop Loss, and lot size doubling to enhance trading effectiveness in trending markets.
Trade Assistant MT5
Trade Assistant MetaTrader indicator — a multi-timeframe indicator that is based on three standard indicators: Stochastic oscillator, RSI (Relative Strength Index), and CCI (Commodity Channel Index). It displays current trend directions for M1, M5, M15, M30, H1, H4, D1, W1, and MN1 timeframes. When you follow such an indicator you have a clear picture of the trends across all important timeframes. It doesn't matter which timeframe you attach this indicator to. The indicator can be downloaded for MT4 and MT5.
Intrabar Volume Flow
An indicator which visualizes how volume changes over time within each bar. It shows tick volume in a rolling histogram format.
A 3 line script that tells you how many bars are on your chart
A script which when dragged onto the chart will print out in the experts window the number of bars that are on that chart - like magic.