Discussing the article: "MQL5 Wizard Techniques you should know (Part 90): Fenwick Tree Money Management with 1D CNN in MQL5"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: MQL5 Wizard Techniques you should know (Part 90): Fenwick Tree Money Management with 1D CNN in MQL5.
This article implements a Fenwick Tree (Binary Indexed Tree) for volume-aware money management inside an MQL5 Wizard Expert Advisor. We structure cumulative volume in O(log n) and apply four scaling modes—linear, conservative, aggressive, and mean-reversion—optionally gated by a lightweight 1D CNN. Practical tests compare the algorithm alone versus the CNN‑filtered approach to illustrate adaptive lot sizing and risk control under varying volume topologies.
When an Expert Advisor uncovers a high-probability entry signal, such as with bitwise combinations in the last article, the question of how much capital to employ can be answered in a variety of ways. For most traders, the safest approach is to scale the position using cumulative volume flow (e.g., On-Balance Volume) over a dynamic window. This process, though, runs the risk of looking at just one bar's volume spike or even attempting to smooth it out with a basic moving average. This completely fails to capture the true distribution of that volume over a given lookback window. This presents some challenges in expressing the shape or topography of the momentum to the Expert Advisor. There can be a lack of structural context.
In this article, we introduce a custom money management class with four Fenwick Tree modes. These are Linear, Conservative, Aggressive, and Mean-Reversion. Despite this assortment, eventual testing in a forward walk showed that relying only on the algorithm ratios without any spatial filter was unfruitful. A large volume spike can trigger aggressive volume scaling back which might be unwarranted in cases where these happen for instance at price exhaustion, where the RSI pivots. Safely navigating real volume spikes may require a paradigm shift: treating volume not as a flat metric but as a topographic structure. We need to structurally map cumulative volume in order to better apply the aforementioned four distinct lenses of our algorithm. This should happen while we use a spatial pattern spotter to better read the terrain in a non-linear manner to better gate our capital exposure.
Author: Stephen Njuki