Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trail Stops for Strategy Builder
Collapse
X
-
Trail Stops for Strategy Builder
Is there any way someone could give me the instructions to put an trailing stop for my automated strategy with TRAIL STOP, TRAIL TRIGGER, TRAIL PRICE, AND TRAIL FREQUENCY. I want to set the stop @16 ticks, trigger @ 8 ticks, trail behind price @ 12 ticks, and have a frequency of 2 ticks. I cant figure out how to do that in strategy builder. Thank you.Tags: None
-
Hello misterbehm3,
Thank you for reaching out.
My colleague Chelsea has created the TrailBuilderExample_NT8 for the Strategy Builder that may be found at the following link:
The example uses the variables TrailFrequency, TrailStopDistance, CurrentTriggerPrice, and CurrentStopPrice in the actions and conditions to create a trailing stop. You may view this strategy in the strategy builder by downloading the file at that link then going to Control Center > Tools > Import > NinjaScript AddOn. Select the downloaded file. Now the strategy will be an option to select in the Strategy Builder.
Please let us know if we may be of further assistance.
-
I have seen that post and reply many times on the forum. It only has the stop strategy for a long position. How do I set it up for long and short in the same strategy? Thanks
Comment
-
Hello misterbehm3,
That sample is only made for 1 side so that the concept can be easily explained. You would need to add new sets for short trades and also other sets for the trail movements.
I would suggest to make just a long side strategy and make sure you 100% understand what each set is doing before trying to add short side code. Once you feel 100% confident you know what each set is doing, create a new empty strategy and rebuild it in the exact same way but for the short side. Then test the short side strategy and make sure that does shorts how you expect. After that you could make a third strategy that combines both sides.
The sample requires all 4 sets to do the trailing just for the long side which is going to need to be duplicated for the short side. You will have to make individual variables for both the long and short side code that are independent. Set 1 would still be used to reset variables but you would need to make 3 new sets for the short side which work independently of the existing 3 sets.
The main take away from that sample would be how the CurrentTriggerPrice and CurrentStopPrice variables are used. Those variables are used to control how the trailing happens. The 4th set is also important, each bar where the CurrentStopPrice is set the order is resubmitted so it can continue to be updated and stay active.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment