Free Automated Stop and Target NinjaScript
$0.00
This Free Automated Stop and Target NinjaScript will set a resting stop loss market exit and a limit profit target exit at the time your entry order is filled.
Overview
This Free Automated Stop and Target NinjaScript will set a resting stop loss market exit and a limit profit target exit at the time your entry order is filled.
This NinjaScript add-on is 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
You can ignore the entry logic in this code which is copied from our Free Random Trading Direction NinjaScript - it doesn't matter how you get into a position, this code determines how to get you out. All the work of the Free Automated Stop and Target NinjaScript is being done in the OnPositionUpdate method of the NinjaScript.
Calculate must be set to on each tick.
If you paste this exit logic into your code, make sure your entries have a signal name that the exits reference. In this case they’re “long” and “short”.
Adjustable variables
The restingStop and restingTarget variables located in the Dashboard region of the Free Automated Stop and Target NinjaScript determine the number of ticks away from the entry price your exit orders will be placed.
Notes
The Free Secondary Series NinjaScript add-on is a single zip file that you import directly into NinjaTrader.
This code will not work with releases prior to NinjaTrader 8.