Loading…

Signal Feature Logger

Building a labelled dataset for a signal usually means one of two flawed workflows: log the signal immediately with an empty outcome column and fill it in later by hand, or log signal and outcome together after the fact from a backtest report that has already thrown away the exact indicator state at the moment the signal fired. Both lose information or add manual work. This EA does neither. When its demo signal fires it captures a full feature snapshot for that bar - RSI, ATR in pips, the fast MA's slope in pips, spread, hour of day and day of week - and holds it in memory rather than writing anything yet. Only once InpForwardHorizonBars bars have actually closed does it compute the real forward outcome: return in pips, maximum favourable excursion, and maximum adverse excursion over that window, correctly signed for a buy versus a sell signal. The CSV row is written once, complete, with every column including the Win/Loss label already known - there is no placeholder row to update later. The fast/slow moving average cross wired up as DetectSignal() is a placeholder only, present so the logging framework has something to log. Replace its body with whatever condition you actually want a labelled dataset for; the pending-signal bookkeeping, feature capture and CSV writer around it do not need to change. Notes and limitations - This tool never places an order. It is a logger, not a trading system. - A signal within InpForwardHorizonBars bars of the end of a backtest run (or of "now" in live use) never reaches zero remaining bars and is simply dropped when the EA is removed - there is no outcome to log yet. - MFE and MAE are computed from bar highs and lows over the horizon window, not tick-by-tick, so they are a bar-resolution approximation on a fast-moving instrument, not an exact intrabar figure. - The placeholder MA-cross signal is not a strategy recommendation; it exists only to exercise the logging framework end to end. - On MQL5, a signal detected in the first few bars right after the EA is attached can be silently skipped if an indicator handle has not finished its initial calculation yet - this shows up as a slightly later first logged row than on MQL4, not a missing feature.

Expert advisor · MT5 · v1.0 · Free

About Signal Feature Logger

Signal Feature Logger is a script for MetaTrader 5 based on RSI, Moving Average and ATR. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Fast ma period, Slow ma period and Forward horizon bars. MQL source code included.

Files in the download: SignalFeatureLogger.ex5, SignalFeatureLogger.mq5, SignalFeatureLogger.txt.

Settings

SettingDefaultWhat it does
Fast ma period10Fast MA period for the demo signal
Slow ma period30Slow MA period for the demo signal
Forward horizon bars20Bars to wait before logging the forward outcome
Rsi period14RSI period captured as a feature
Atr period14ATR period captured as a feature
Max pending signals50Cap on signals awaiting their forward outcome
Csv file nameSignalFeatureLogger.csvFile written under MQL5\Files\

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Buy/Sell Arrows · Alerts · RSI · Moving Average · ATR · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria