Cart 0


The Money Management Algorithms also known as the Equity Curve Algorithms is a tool that we began developing in 2005 and finished the first revision in 2011. This is a tool that we continue to research and upgrade. It is a trading system for a trading system so that you can analyze the equity curve to manage the money you allocate to your trading systems. This tool is completely open code for user customization and requires a Non Disclosure Agreement.

This is the only tool that I know of that will allow you to extensively test ideas related to money management and trading the equity curve of your own system and then automate the exact setup that was tested. I have seen tools that offer basic money management ideas (although not as extensive) or the ability to back test but they do not offer the ability to automate the same setup, requiring manual processes or end of day analysis which are not efficient for short term traders or day traders or traders who need to make decisions intra-day.

Here is the Problem

The problem with writing an equity curve algorithm rule within your original strategy is simply the fact that once you turn the strategy off, based on your equity curve rule, it does not continue to generate an equity curve that can be tracked. We want to track the equity curve in it's purest form as a simple market analysis based strategy without equity curve rules so that equity curve rules can be applied separately.

The money management algorithms watch the original strategy trade in SIM mode and select which LIVE trades to take based on the criteria that it is given based on the research and method you have selected from back testing the setup before LIVE trading.

In the video we show a simple code set for stopping on a drawdown. Once we stop,, there is no way to know how the strategy is doing. We can blindly start the strategy after a certain period of time but that is "shooting form the hip". What if the strategy continued to under perform while it was turned off?

My First Revision

When I first started developing the Money Management Algorithms, back in 2005, I would export the trade information directly from the strategy for the Marketposition, Open Equity, and Closed Equity to a text file. I then imported this information into a new window that included my original strategy plus the text file and modified my original strategy code to look at the trade information that was setup as a sub data series.

This approach was a nightmare to implement when trading multiple strategies on an intra-bar basis. Updating 10+ strategies with exported data files and re-importing into a new window and then checking the signal was a slow process, which was too slow to work.

I could test the concepts to see that they were valid but implementing them on intra-day charts was not realistic.

Here is How the MM Algorithms Work

In platforms such as Tradestation and MultiCharts a DLL is used to look at the original strategy and track it through its entire history of equity peaks and drawdowns. In NinjaTrader, C# .NET can be used, without a DLL to look at the original strategy.

Looking at the original strategy with a DLL or advanced programming language and then trading LIVE in a different window with the Money Management Algorithm is key to keeping the original strategies equity curve in its purest form.

If you are using Tradestation or Multicharts and you are not using a DLL, then you are not keeping the integrity of your original equity curve.

We show the basic setup in the video with the original strategy on the left and the Money Management Algorithm on the right. This current format was finally developed in 2011.

The Money Management Algorithm Rules

It is critical to understand that the Money Management Algorithm Rules are a tool that is used to analyze the equity curve of your trading system to help you manage your money. It is a trading system for a trading system. There are 12 basic rules that we discussed in detail below. The 13th Rule is based on the Martingale Rule for well capitalized traders.

These concepts may be new to you but they are fairly basic ideas that we have shared over the years. The actual setup is the real challenge and having the open code is the real benefit since you will be able to customize the Money Management Algorithms with any new ideas that you have once you understand the structure.

Each individual rule is discussed below. When you setup the Money Management Algorithms, keep in mind, you can select any combination of rules. While we do not recommend using more that 2 or 3 in most cases, there are literally 1000's of different solutions. An optimization algorithm is also included so that you can officially test the individual money management algorithm rules.

RULE ONE - Moving Average

The closed equity curve dual moving average is Rule One of the Money Management Algorithms. Moving averages have become a classic example in trading system development. I have found that applying the dual moving average to the equity curve of your trading system can be a great way to know when to be "invested" in your trading system.

The closed equity curve moving average money management algorithm uses two default inputs of L1 = 20 and L2 = 40, meaning that if the average of the last 20 trades is greater than the last 40 trades then we trade the original strategy.

The trade frequency of a trade strategy should be considered. If a strategy trades less then the L1 and L2 should be lower. If a strategy trades more frequently, then the L1 and L2 can be higher and the ratio could also be higher. For example L1=50 and L2=300 for a strategy that trades more than 10 times per day.


The closed equity curve dual moving average is Rule Two of the Money Management Algorithms. The ADX is an indicator that typically determines the strength of trend in a market. It can also be used to determine the strength of trend in the equity curve of a trading system. Trading your strategy only when the equity curve has a strong trend is the concept that we use in this setup.

A sideways equity curve can "tie up" capital. If the equity curve is choppy, allocating capital to another strategy could be an approach to use so that capital allocation can become more efficient and allocated to the strategies that include equity curves that are in a trend.

This Rule could be combined with other rules and only measure strength of trend and not direction of trend in your equity curve. Combining it with Rule 1 for example, could help to determine the direction of the trend.

RULE THREE - Stochastics

The closed equity curve stochastic is Rule Three of the Money Management Algorithms. The stochastic is an indicator that typically determines if a market is overbought or oversold and is also known as an oscillator. In the markets, traders like to look for a long entries or short exits in oversold conditions and short entries or long exits in overbought conditions.

It is important to know your original strategy when applying specific money management algorithms. If a strategy has a low winning percentage (ex: 30-40%), such as one with tight stops that let the winners run, then starting when the strategy is oversold and stopping when it is overbought could be one approach. If a strategy has a higher winning percentage (ex: 65-70%) then starting when it is overbought and stopping when it is no longer overbought could be an approach. By default, the stochastics setup for Rule 3 is based on trading your original strategy when it is above a threshold.


Rule four is the Money Management Algorithm that tracks the Closed Equity or closed trade equity and measures its Relative Strength. You can then trade your original strategy if the Relative Strength Index of the last RSI_Length (or 14 by default) trades is above the RSI_Threshold of 70 (by default). The RSI_Length and RSI_Threshold are input parameters that can be changed.

The Relative Strength Index is a popular indicator for market analysis but it can also be applied to the equity curve. It is the type of indicator you would apply if you wanted to trade your strategy only when the equity curve was strong.

Since the Money Management Algorithms are an open code solution, they can be customized and modified so that this rule could be changed to trade with the closed equity curves RSI was "weak" if a buy the dip in equity curve approach was desired.

RULE FIVE - Average Trade Profit

The Average Trade Profit, Rule 5, of the Money Management Algorithms, is one of my favorite rules. As a daytrader or short term trader, the average trade profit is one of the most important numbers a trader should monitor. Watching thy cycles of a trading system based on the average trade profit can be an effective way to determine when to allocate capital to a trading system.

In general, a negative average trade profit can tell you that a system is under performing, and can be a metric used to "shut off" a trading system. Additionally, a very high average trade profit can signal a very "hot" strategy and could be a time to "stop while ahead".

Using a range that includes a lower and upper threshold for the average trade profit can offer a "sweet spot" trading range for your strategy to trade in its "normal" range.

RULE SIX - Pinpoint Entry

Entry efficiency is one way to incrementally improve your strategy. If you have built a basic trading system with good metrics but always "seems" to have some adverse excursion on every trade, working on your entry may be a beneficial approach.

It can be difficult to build a strategy and then program it to track what would be your original entry but enter at a "better" price. It is not as simple as using a bigger limit order since a strategy built on intra-day bars, could cancel the original entry order in the future based on changing market conditions for a limit order that was "further away" from the market.

Rule 6 can continue tracking your original entry and "better and more pinpoint" entries can be tested and then automated against your original strategy.

This setup was one of the original reasons why the Money Management Algorithms were developed.

RULE SEVEN - Drawdown Stop

Rule 7 is a classic money management algorithm technique. It is the concept of using a stop loss on a trading system. While a strategy has a stop loss, a trading system does not typically have its own stop loss to say, "stop trading the system". This can be done on a discretionary basis based on the worse case drawdown or a multiple of the worse case drawdown but this is a systematic way to "shut off" your trading system.

The real benefit though, is the ability to know when to start again based on a run up. If a strategy goes into a drawdown and never recovers, then it was best to "shut it off" forever. However, if over time the strategy becomes in sync with the market again and has a runup, this algorithm can turn the strategy "back on" based on the run up amount. It is impossible to test and automate this approach without this type of setup. While it is easy to program a stop loss for the overall strategy, the equity curve would no longer be generated and knowing if the the strategy recovered, would be unknown.

RULE EIGHT - Average Drawdown

Rule 8 simply gets into a strategy during a draw down by measuring the draw down against it's average open equity draw down. There can be different ways to measure strength and weakness in a trading system, and this is one approach to "buying the dip" based on a draw down in your trading system.

Buying the dip can provide a good entry price with less adverse excursion and potentially improve entry efficiency when combined with Rule 6 to ensure that the entry price is better than or equal to the entry price of the strategy when buying the dip in the equity curve. For short signal, buying the dip in the equity curve would translate to entering your short on a market rally.

Combining this with Rule 9 by varying the L1's so they are not the same value, is a combination I like to test and use and is one of the Degradation Algorithm setups.

RULE NINE - Average Drawdown II

Rule 9 is the opposite of Rule 8. It syncs up with your original strategy during open equity strength by measuring the draw down against it's average open equity draw down. There can be different ways to measure strength and weakness in a trading system, and this is one approach to entering into your original strategy during strength based relative measures of open equity drawdown as compare to its average.

Different types of strategies respond differently to different money management algorithms and the type of strategy should be considered. A strategies winning percentage can affect the way it responds to different equity curve algorithms.

Combining this with Rule 8 by varying the L1's so they are not the same value, is a combination I like to test and use and is one of the Degradation Algorithm setups.

RULE TEN - Moving Average OE

In Rule One, we discussed the closed equity curve moving average. Rule Ten is the open equity curve moving average. The closed equity curve is based on the equity at the end of each trade. Open equity is based on the equity at the end of each bar. When a strategy is flat, closed equity and open equity values are the same.

This setup works by measuring the L1 (default = 10) and L2 (default = 20) of the open equity curve and taking trades in your original strategy if L1 is above L2. Some tricks of the trade are to make the value of L1 > L2 and the equity curve algorithm will do the opposite, by taking the original trades when the equity curve is "weak".

Another trick is to make L1 = 1 when L1 < L2 (or L2=1 when L1>L2) and it will be more of a single moving average since the L1 = 1 is equivalent to the actual equity curve instead of its moving average.


Rule eleven measures the open equity of the RSI, and takes trades based on the original strategy if the relative strength of your open equity curve is above its threshold. By default, Rule 11 uses a 14 bar look back period and a threshold of 70. The relative strength of your open equity curve must be strong by default to use this.

Since the Money Management Algorithms are distributed as open code, they can be customized. One thing you can do is combine an open equity rule with a closed equity rule. In this case you could customize the RSI rule to start trading when the RSI is weak based on Rule 11 but look for Rule 1, the closed equity curve dual moving average to be positive.


RULE TWELVE - Buy Drawdown

Rule 12 works to take pieces of a strategy's upward moving equity curve by entering when the strategy is in a draw down and then exiting when the strategy is in a run up. This is one of my favorite approaches. It does require patience and may miss some really big winning streaks but can also provide a "softer" landing for a strategy that is under performing in a changing market and starting to degrade.

This approach is the basis for the Degradation Algorithm.

The inputs for this rule are DDStart and RunUpStop. By default they are set at $3000 each per contract so for example, if the strategy goes into a $3000 drawdown per contract, then the algorithm will start trading and then once the strategy is at a $3000 run up it will stop trading. Increasing these values will lower the trade frequency while decreasing these values will increase the trade frequency.

RULE THIRTEEN - Consecutive Losers & Martingale

Rule 13 is more unique in the way it is setup so we take some time to explain it. There are four different inputs in the first section with different options. By nature Rule 13 starts trading after a defined number of losers. If the Martingale input is also turned on, then it will double down on each trade. There is also a rule to stop trading after a defined number of winners (once it has started) and another input that will stop trading after a defined equity runup.

When using the Martingale setup, it can become capital intensive. We show the setup in the video and how it can quickly trade up to 32 contracts. Two more losers would have the contract size to 128. I wouldn't recommend trading this way unless your account was well into the 7 figure range.

MM Algorithm Optimization Tool

The Money Management Algorithm Optimization tool is one of the tools that is included. It allows you to run an optimization so that you can test which rule works best for your strategy. You can simply optimize from Rule 1-13 (13 tests total) using the default parameters to get a quick idea. It will test each rule on its own and the results can be viewed in the optimization report.

The Optimization Algorithm only tests one rule at a time. The Money Management Algorithms can use any rule and any combination of rules so that more than one rule can be used. For this reason, it is not efficient to run an optimization in the Money Management Algorithms as optimizing Rules 1-12 from 0 to 1, would give you the best combination but would require 8,192 tests, which can be very time consuming. The Optimization Algorithm was created to provide a quick general answer.

The Combination Algorithm

This is an example of a custom money management algorithm that can be downloaded from the Members Area. The Money Management Algorithms are an open code product so there are an infinite number of customizations. This is an example of how the Money Management Algorithm code from two different strategies can be combined into one setup.

In this example, we look at Exhaust and Reverse E-mini S&P on 1 minute and 5 minute bars and use the Money Management Algorithm to trade this only when both strategies are doing well.

It is possible to continue to customize this so that it would "looks at" three or more strategies instead of just two strategies. The coding example is in the Members Area.

The Degradation Algorithm

The Degradation Algorithm is a setup within the Money Management Algorithm when combining rules that start trading your strategy when it is in a drawdown and exiting when it is in a runup. Rule 6 and Rule 12 as well as Rule 8 and Rule 9 (with varying L1's) are examples of how we combine the Money Management Algorithm Rules into a combination that we call the Degradation Algorithm.

We know that any good system works on some sort of market inefficiency and bias. These biases will change over time and your strategy will more than likely "degrade" and eventually hit a worse case drawdown.

Instead of trying to develop a strategy that will avoid this scenario, use the Degradation Algorithm to manage your strategy when it starts to under perform and even profit when it goes into a draw down.

Second Derivative MM Algorithm

This is a trick of the trade. A small trader can create a Martingale equity curve (MM Algorithm) based on an original strategy by using the equity curve of the martingale money management algorithm to then trade a single contract.

Why do this? A martingale based equity curve, that doubles down after each loser, creates sharper equity curves that could be more clearly read by an indicator or money management algorithm.

This is a money management algorithm of a money management algorithm and why we call it the second derivative of the trading system.