Loading…

Strategy Fingerprint

Comparing two strategies (or the same strategy before and after a tweak) usually means staring at two separate equity curves and trade lists and guessing whether they behave alike. StrategyFingerprint instead reduces each trade-return series - any length, any unit, currency or R-multiple or percent - to one fixed 8-number vector: a Sharpe-like ratio, win rate, profit factor, average win/loss ratio, max drawdown fraction, lag-1 autocorrelation, skewness, and a sample-size confidence score. Every component is deliberately squashed into roughly [-1, 1] before comparison, so a strategy with a naturally large profit factor number does not automatically dominate the distance calculation just because its raw units happen to be bigger than, say, win rate's already-bounded [0, 1] range. SfpDistance() is then a plain Euclidean distance over the 8-dimensional vector, and SfpSimilarity() turns that into a 1/(1+d) convenience score for ranking candidates. This is a shape comparison, not a statistical hypothesis test - two fingerprints scoring close together means the two return series behave similarly along these eight dimensions, not that they are provably the same underlying strategy. It is intended as a fast triage tool (which of forty backtest variants are actually different from each other, which one looks suspiciously identical to a strategy already logged) rather than a rigorous similarity proof. Notes and limitations - All 8 components are heuristic scalings chosen for rough comparability, not a statistically derived or calibrated metric space - treat distance/similarity as a ranking aid, not a p-value. - SfpBuild() ignores trade order beyond lag-1 autocorrelation and the drawdown walk; it will not detect similarity/difference in longer cyclical patterns. - Profit factor and win/loss ratio are both capped at 10.0 before scaling, so two strategies with profit factors of 12 and 40 report as identical on that component. This is intentional (caps a single runaway component from swamping the Euclidean distance) but means very high profit-factor strategies are less distinguished from each other on that axis specifically. - Mixing units across the two series being compared (e.g. currency P&L vs R-multiples) leaves SharpeLike and MaxDrawdownFrac still valid (both are already ratios/fractions) but weakens the intuition behind comparing them directly - prefer same-unit series when possible. - Fewer than 2 trades in a series produces an all-zero, invalid (valid=false) fingerprint rather than a divide-by-zero crash; callers should check the valid flag before trusting a comparison.

Script · MT5 · v1.0 · Free

About Strategy Fingerprint

Strategy Fingerprint is a script for MetaTrader 5. It has 1 setting, such as Trade count. MQL source code included.

Files in the download: StrategyFingerprint.mq5.mqh, StrategyFingerprint.txt, StrategyFingerprintDemo.ex5, StrategyFingerprintDemo.mq5.

Settings

SettingDefaultWhat it does
Trade count120Number of synthetic trades generated per series

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: MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria