NinjaTrader is free to use for advanced charting, backtesting & trade simulation. This article briefly covers the powerful NinjaTrader8 Strategy Builder. This feature is available within the NinjaTrader platform.
The Strategy Builder allows anyone to create automated strategies without having or needing coding experience. The process is completed in a few clicks of a mouse. We define the conditions and the actions we want by dragging and dropping and NinjaTrader8 will create the strategy. The strategy only takes a few minutes to build.
We can see the results below of the strategy we will be creating today.
We will be automating one of my favorite breakout strategies, the Initial Balance breakout. It’s a simple strategy that can catch some big moves. This is one of my favorite strategies to use in bull markets. The trigger is simple. The Initial Balance period is completed and a bar closes above the Initial Balance high. I like to use 5 minute bars or 30 minute bars to trigger the trade. This article will be discussing how to create the strategy using the indicators and NinjaTrader Strategy Builder. Continue reading if you would like to know more.
** Purchase the indicators using the link below **
START BUILDING THE STRATEGY
The first thing we want to do is open NinjaTrader Strategy Builder. This is where we will be creating our automated strategy. Open the NinjaTrader control center and click new. So go ahead and open the Strategy Builder to start building our strategy.
*———— New Strategy ————*
The next screen we will see is the Strategy Builder screen. This is where we can create and edit new and existing strategies. Today we will be creating a new strategy. Click next to continue with a new strategy or click the drop down menu to edit existing strategies.
*———— Give it a name ————*
After we create a new strategy, we will need to give it a name and description. The description isn’t required but it’s helpful if we have created many strategies. The name should contain no special characters or spaces. Try and create a name that identifies what the strategy is doing. This will help organize our strategies without needing to open them and see what they are doing. This strategy is named
“InitialBalanceBreakoutStrategy”
This strategy will only enter long trades when it detects an Initial Balance Breakout. We will give it parameters and rules later on. For now, it only needs a name. Click next to continue building the strategy.
*———— Default Properties ————*
The next screen we see can be a little bit intimidating for beginners. Don’t worry. We will be leaving these settings as default. For more advanced users, this screen is where we will make more advanced order handling strategies. We use this screen to determine trade size, slippage, layering, and more. For now, we will leave them on default and click next to continue building the strategy.
*———— Additional Data ————*
This screen is where we can specify multi-timeframe strategies. We can also specify different markets to monitor and trigger trades. We won’t be using these settings this time around. Our strategy is a simple breakout strategy. We will skip these settings and continue building our strategy. Continue to the next screen.
*———— Inputs and Variables ————*
This screen contains the Inputs and Variables to our strategy. Here we can create our profit and stop targets. This step isn’t required but it’s necessary if we also want to use the NinjaTrader Optimizer. More on that later. Create two Inputs by clicking add under the Inputs section. Name them something easy like “Profit” and “Stop”. Set the type to int. This is important. After we have created our inputs, continue to the next screen.
CREATE THE RULES
*———— Conditions and Actions ————*
This is probably the most important step in building our strategy. I have already created the set of rules. When we first get to this screen it will be blank. This screen is where we define how our strategy behaves. We define our rules in the Conditions and Actions screen. There are a few things we need to do to make sure our strategy does what we want it to do. We need to create our set of rules and then tell the strategy to open a new long when our set of rules are satisfied.
There are 5 conditions in this strategy. They are:
One Bar has to close above Initial Balance High
Price is in an uptrend
The Initial Balance period is closed
The previous close is below the Initial Balance High
The Initial Balance High does not equal 0
These are the conditions I look for with an Initial Balance breakout. See the steps below to set up these conditions
*———— Rule 1 ————*
The first condition is that one bar has closed above the Initial Balance High. Click add to begin defining this rule. The first screen will be blank and contain two areas. Here we set the condition that the close is greater than the Initial Balance High. On the left side we click the Price folder and select close. In the middle we select Greater. On the right side, we click the Indicators folder and navigate to the indicator we will be using in the strategy. Select TheoryAffinityIB_8 and a menu will appear below it. Here we select the indicator settings and the level we will be using. We can choose to have the strategy plot the indicator by selecting Plot on Chart. This is not needed and we can choose to load the indicator separate from the strategy. Next, scroll down to Value Plot and select IBHigh. This is the level we will use to determine the breakout. Verify the conditions and indicator settings are correct then click OK to continue add the remaining conditions.
*———— Rule 2 ————*
The 2nd condition requires price be in an uptrend. I use exponential moving averages to make sure price is not in a downtrend is this is a simple stop hunt. The fast EMA above the slow EMA says price is trending higher. On the left and right sides, select the indicator. Select EMA1 on the left side and EMA2 on the right side. Moving averages are a simple way to identify trending conditions. When a fast moving average is greater than a slow moving average, this is good indication that price is trending higher. In this step, make sure the Plot to Chart setting is not selected for both sides. Verify the settings are correct and select OK to continue adding our rules.
*———— Rule 3 ————*
The 3rd condition requires the Initial Balance period to be closed. The standard period is 60 minutes calculated from the open. If the open is 8:30 am then the Initial Balance period closes at 9:30 am. Set these rules by clicking the time folder on both sides. On the left side, click Time Series. On the right side, click Time Value. Choose a time after the Initial Balance period closes. This rule ensures we don’t enter traders before the Initial Balance period has closed. Click next to continue adding our rules.
*———— Rule 4 ————*
The 4th rule ensures that the value we are using for a breakout is a valid number. This step is required for most indicators. NinjaTrader8 initializes values to “n/a” or “0”. We need to make sure the indicator has plotted the correct value before executing trades. This is how we set up that rule. On the left side, select the indicator and set the Value Plot to IBHigh. In the middle select Not Equal. On the right side, click the Misc folder, navigate down the list to Numeric Value and set it 0. Click next to continue adding our last rule.
*———— Rule 5 ————*
The 5th rule is optional. This rule ensures that price is breaking out. Without this rule, the strategy will trigger trades at any time price is above the Initial Balance High. This rule makes sure the price was previously below the IBHigh. We add this rule to make sure we are only buying the breakout. To configure this rule, select Close on the left side. Set bars ago to 1. In the middle, select Less equal. On the right side, select the indicator, set Value Plot to IBHigh. Verify the settings are correct and select OK.
*———— Add long position ————*
The last part is to have the strategy enter a long trade once all the conditions are satisfied. On the lower half of the Conditions and Actions screen, click add. Here we will click the Order Management folder and click Enter long position. We set the quantity per trade and then give the signal a name. The signal doesn’t need a name but it’s good practice to give it one. So go ahead and give it a name. Remember this name for the next few steps. The name should be easy, simple, and identify what the signal is doing. This signal is named “Long IBH”. Click OK and verify our Conditions and Actions are correct.
Feel free to add any additional rules you like. When we’re all finished adding our Conditions and Actions, click next to continue building the strategy.
DEFINE PROFIT TARGETS AND STOPS
This screen is where we set our stops and targets. It will start blank and we will select our targets. I have already set the profit and stop targets. Let’s walk through it below.
*———— Create Profit Target ————*
Click add to create a profit target. Select Profit Target. Type in the name that we have given our signal, “Long IBH”. Next select ticks. On the Value, hover over the space and select Set. Click the User input folder and select Profit. Click OK to add our profit level.
*———— Create Stop Loss ————*
Click add to create a stop loss. Select Stop loss. Type in the name that we have given our signal, “Long IBH”. Next select ticks. On the Value, hover over the space and select Set. Click the User input folder and select Stop. Click OK to add our stop level.
*———— Strategy Analyzer & Strategy Optimization ————*
We are now finished building our automated strategy and we can click Next and then Finish. We can now begin using this strategy in any market. Using NinjaTrader8 Strategy Analyzer, we can back test strategies and see the results over a given period. We can also use the NinjaTrader8 Optimizer to find the best settings for our strategy. This is why it was important to create Profit and Stop variables. The optimizer will use these inputs to find the best settings for the strategy. It will run multiple backtests and the optimizer will change the settings automatically each time. Then it will give the best results using the given parameters and settings.
Congratulation for the indicator.
do you have a Tradestation or Multichart version of it ???
Should be nice to see it within an automatic trading system...
let me know at solignani@hotmail.com
Great article 👍