Inside bars are formed when the current bar does not close above or below the previous bar. This strategy identifies inside bars and sends buy or sell orders if price breaks above or below the inside bar. It is fully automated, meaning it will send an order to open a position and immediately send a target limit and stop order to close the position based on Average True Range. Additionally, the stop order will move as price moves in your direction. The script is written to use on a micro futures chart (/MES, /MNQ, /MYM, etc) but imports the mini futures data (/ES, /NQ, /YM) and uses data from the mini futures to signal a buy/sell order on the micro futures.
-
Open Ninjatrader
-
From the Control Center, select New, Ninjascript Editor
-
Press +, select New Strategy, press Next, name it 'InsideBar', press Generate
-
Paste the code from
inside_bar.cs
in the NinjaScript Editor window, Save and Compile -
From the Control Center, select New, Chart, Instrument: /MES
-
Righ-click the chart, select Strategies
-
Add the 'InsideBar' strategy, make sure Account = SIM, press OK
-
From the Control Center, press the Enabled checkbox to activate the strategy