Exit at breakeven if first tick goes against you

This free NinjaScript strategy will place a limit exit order at break even if the first tick after your order is filled is in the adverse/wrong direction.

This NinjaScript download is a single zip file that you import directly into NinjaTrader. It’s not assembled which means you have full access to view and change the source code either in NinjaScript Editor or your preferred way to edit .cs files.

Details / Instructions:
Calculate must be set to on each tick.

If you paste this exit logic into your own code, make sure your entries have a signal name that the exits reference. In this case they’re “long” and “short”.

This code will not work with releases prior to NinjaTrader 8. Click here if you don’t know how to install NT strategies. Use at your own risk, and backtest backtest backtest before you go live with any strategy.

Leave a Reply

Your email address will not be published. Required fields are marked *