Loading…

Compounding Frequency Demonstrator

Compounding frequency is usually taught with an abstract "8% a year, paid monthly versus annually" example that has nothing to do with how a trading account actually grows. This script replays the identical trade-by-trade return three different ways from the same starting balance: one balance compounds after every single trade, a second sums each day's trades arithmetically and compounds once at the end of the day, and a third does the same at the end of each month. The three columns are built from the exact same return stream, so the only variable is how often the account is allowed to reinvest. Compounding more frequently on a positive edge grows faster, because each gain is immediately working with a larger base for the next trade - the table shows the gap widening trade by trade rather than asking the trader to take the effect on faith. On a losing edge the direction flips: less frequent compounding shrinks the account more slowly. The per-trade return can be typed manually, or measured from this account's own closed trade history (as an average percent of a fixed starting balance) so the demonstration uses a number the trader recognises rather than a textbook illustration. Notes and limitations - This is an idealised model: it assumes a constant per-trade return percentage, which real trading never delivers. The point is to isolate compounding frequency as the only variable, not to forecast an account. - Account-history mode measures the average dollar profit per trade as a percent of ONE fixed starting balance, not the balance at the time of each historical trade - stated here plainly since it is the simplification that keeps the three columns comparable to each other. - A per-trade return of -100% or worse aborts the script (nothing left to compound); a genuinely ruinous single trade cannot be demonstrated this way.

Script · MT4 · v1.0 · Free

About Compounding Frequency Demonstrator

Compounding Frequency Demonstrator is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Use account history, Magic filter and Symbol filter. MQL source code included.

Files in the download: CompoundingFrequencyDemo.mq4, CompoundingFrequencyDemo.txt.

Settings

SettingDefaultWhat it does
Use account historyfalseIf true, derive the per-trade return from this account's own closed history
Magic filter-1Account-history mode only: magic filter (-1 = all)
Symbol filterAccount-history mode only: symbol filter ("" = all)
Starting balance10000.0Notional starting balance the demonstration is run forward from
Manual trade return pct0.4Manual mode: average per-trade return, percent of starting balance
Trades per day4How many trades make up one "day" bucket
Trades per month80How many trades make up one "month" bucket
Total trades240Total trades to run the demonstration across

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria