Menu
Cart 0

Money Management Algorithms for NinjaTrader


Our money management algorithms are designed to trade the equity curve. Equity curve management can improve risk management and reduce draw downs so that less capital is required to trade a strategy or portfolio. Money Management Algorithms which we will also refer to as our Equity Curve Algorithms are a trading system for your trading system.

Our Money Management Algorithms are the only Equity Curve Management tool that we have found that will let you backtest and automate within the same trading setup so that your backtest engine is the same as your automation. All you have to do is turn automation on, once you have found the equity curve manager that works best with your strategy and return goal. 

NinjaTrader Money Management Algorithm Examples

NinjaTrader MACD Martingale Strategy

Cobra CounterTrend V DAX

Cobra CT Vb E-mini S&P

 

The money management algorithms “watch” your original system (also know as “base”, "parent", or “master” system”) run in order to generate the base equity curve and trades while the money management algorithm then makes its decisions based on the results of the master system to trade the "algorithm" or "child".

The money management algorithm will only allocate real trades when the selected money management algorithm rule is true. For example, the first rule in our Money Management Algorithms is a dual moving average of the closed trade equity curve. This rule requires that the moving average of the short period (L1) of the closed equity curve must be greater than the moving average of the longer period (L2) closed equity curve.This is similar to a moving average crossover strategy based on price data in the market except that we use the moving average of the equity curve and require that it is “up” in order to take trades in the system.

Another example of one of our systematic money management algorithms is to stop trading at a pre-defined draw down and then to start again once there has been a run up of a predetermined amount from the equity curve lows.

Equity Curve Algorithm 1

Equity Curve Algorithm 2

The equity curve example above is an example of combining the moving average rules with the drawdown stop rule. To accomplish these equity curve management strategies successfully we used DLL’s in Tradestation and MultiCharts. In the NinjaTrader Platform, the use of DLL’s is not required since the advanced programming techniques in the algorithm allow us to see results in other strategies currently running in the same workspace.

This is the only product that I have found that will allow real-time analysis and automation of equity curve and money management algorithms instead of end of day calculations that need to be manually implemented.

Our equity curve money management strategies currently include Thirteen different equity curve strategies shown below (8,192 combinations):

Each algorithm can run separately or be combined with any or all of the other algorithms. There are 8,192 combinations of how the Money Management Algorithms can be applied.

Rule 1 - Trade the strategy only if the dual moving average of its close equity curve is up with L1 and L2 as inputs for the slow and fast moving average.
Rule 2 - Trade the strategy only if the ADX of the closed trade equity curve is above the ADX Threshold.  ADX is strength of trend and does not specify direction of trend.  This rule is best combined with another Rule.
Rule 3 - Trade the strategy only if the Stochastic of the closed trade equity curve is above the Stochastic Threshold.  A strong stochastic can mean a strong equity curve. 
Rule 4 - Trade the strategy only if the RSI of the closed trade equity curve is above the RSI Threshold.  A strong RSI can mean a strong equity curve.
Rule 5 - Trade the strategy only if the Average Trade Profit of the last 10 trades is with the specified average trade profit range.  We typically like to trade if the average trade profit is positive and above 0.
Rule 6 - Improve entry efficiency by entering at better prices by looking at the base strategies marketposition and entry price and placing limit orders to improve on that price by a specified dollar amount based on a closed bar basis.
Rule 7 - Stop trading the equity curve if it goes into a pre-defined drawdown (set as an input) and then start trading if it goes into a run up of a pre-defined amount from equity valley lows.
Rule 8 - Require the Drawdown be greater than the Average Drawdown of the last 100 bars.  This rule allows entry into a weaker equity curve.  The number of bars can be changed with the inputs.
Rule 9 - Require the Drawdown be less than the Average Drawdown of the last 100 bars.  This rule allows entry into a stronger equity curve.  The number of bars can be changed with the inputs.
Rule 10 - Require the open equity curve dual moving average to be up.  This is different than Rule 1 since it uses the open equity curve instead of the closed equity curve.
Rule 11 - Require the RSI of the open equity curve of the last L1 bars to be greater than the RSI Threshold.
Rule 12 - Enter the strategy on a drawdown by “buying dips” of a specified amount/input.
Rule 13 - Consecutive Losers algorithms lets us start after a specified number of losers.  In Revision 5.0 we add additional inputs to exit after consecutive winners or equity Run Up Amount.  It will also allow us to double down after every loser with the Martingale input.

List of Inputs
Below is a complete list of inputs
for Rev 5.0 in the NinjaTrader Platform
(click to enlarge image)
NT MM Algorithm Inputs

Entry Techniques

 The Money Management Algorithm in Revision 5.0 allow for 4 different entry techniques once the set of Algorithm Rules are met.  After the criteria is met to enter a trade, then the entry can take place on the next bar as a market order, stop order, limit order or Pinpoint Entry II limit order. Pinpoint Entry II is new in Revision 5.0 and is discussed in the next section.

The stop order and limit order inputs have additional inputs of StpEntPts and LmtEntPts. With the stop order we enter on the next bar at the Close + StpEntPts for longs and at the Close – StpEntPts for shorts. For the limit order entry we enter on the next bar at the Close – LmtEntPts for longs and at the Close + StpEntPts for shorts. The point value for the StpEntPts and LmtEntPts is the minimum tick size for the market traded. If the value of StpEntPts or LmtEntPts is too large then the trade may not be entered, especially on smaller time intervals. The best value for these inputs can be 0 or 1 (points/ticks) or to use a market order.

The Pinpoint Entry Algorithm

One of our favorite entry techniques is the Pinpoint Entry Algorithm. In Revision 5.0, we add the Pinpoint Entry Algorithm II.

Most of the time a trade does not immediately go in our favor and we experience some adversity in the trade. Many times we wonder how we could make our system better or what rules we can add to improve our entry. The Pinpoint Entry Algorithm allows us to watch our original strategy trade and then get in at a better price. We can test for the best entry point by changing or optimizing the EntryLoss input parameter. This value is set to a dollar amount of loss. We then wait for the strategy to reach the EntryLoss amount (on a closed bar basis) to then begin trading our original system. This algorithm is used to improve our entry efficiency.

Pinpoint Entry Algorithm II allows us to place a limiit order intra-bar at a point value that “betters” the original entry price. Pinpoint Entry Algorithm II uses a point value instead of a dollar value that is used in the Pinpoint Entry Algorithm Rule 6. The only delay is the first bar of entry on the original strategy. The original Pinpoint Entry Algorithm is Rule 6 and is still included in Revision 5.0. One of the weaknesses of the Pinpoint Entry Algorithm is that it is based on a closed bar basis. Pinpoint Entry Algorithm II is not one of the Algorithm Rules but one of the Entry Techniques and works intra-bar. It can be combined with the Algorithms in the same way the original algorithm can be combined.

This entry technique alone is one of the biggest values in our Money Management Algorithms. The reason we like the algorithms for this rule is the potential for improvement in entry efficiency, average trade profit, and net profit as a percentage of drawdown. It is not easy to program this simple idea into every strategy. Based on your programming skills, trying to add this feature to an individual system can be difficult. This entry technique allows us to quickly add this concept quickly to see if it improves our strategy.

The Optimization Algorithm

In Revision 4.1 of the Money Management Algorithms, we add the optimization tool. The optimization tool allows us to quickly rank the best rules for each strategy by optimizing the Rules from 1-13. Once we rank the best rules we can determine how to combine the rules or then test different entry techniques. This is quicker than optimizing the original strategy inputs from 0-1 for 13 different inputs. This is 8,192 combinations instead of just 13. The optimization tool only tests each rule separately and not the combination of rules.

Learn More about the Optimization Tool

Consecutive Losing Series Algorithm

The Consecutive Losing Series Algorithm includes an algorithm to start trading a your trading system only after x consecutive losers and then stop trading after a winner. The “x consecutive losers” is an input called “LossesToStart” that can be modified and optimized. This strategy will allow you to test perceived opportunities of wanting to start trading after a losing streak of x losers and the stop trading after a winner.

This is similar to a martingale strategy of doubling down after a loser except we are trading zero contract until we get the number of losers that we want. This algorithm is recommended to be tested and traded with more high frequency approaches of at least 250 trades per year.

In Revision 5.0 we add a Martingale option, where you double the contracts after each trade and an equity run up option. By default we stop after 1 winner and then wait for x consecutive losers to start again. The Equity Run Up option will instead, wait for there to be a Run Up in Equity instead of stopping after just 1 winner.

These Money Management Algorithms allow you to test and automate ideas based on stopping and starting a strategy by keeping the base strategy running to make calculations and then take trades based on the calculations in a new window.

You don’t have to know how to program or change existing strategies! The Money Management Algorithms can be run with your current strategies. It will allow you to test closed code systems that you own or lease and allow you to have a more “unique” entry price (in the case of the Pinpoint Entry Algorithm) from other subscribers if you are leasing a closed code trading system.

We officially released the Money Management Algorithms for the NinjaTrader Platform on August 23, 2013.


  • $2,997.00