NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 10-05-2010, 11:14 AM   #1
BillyRayValentine
Junior Member
 
Join Date: Sep 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 0 times in 0 posts
Default SetTrailStop() - Percentage?

Can someone please explain exactly how the percentage offset is calculated in this case?

Will the stop trail the market price by % specified? If so, as market price increases then will the difference between stop and market increase? (e.g. a 1% stop from $5 is 5c, price eventually increases to $5.50 so stop trails behind by 5.5c)

Or is the inital stop created % away from entry price then tracks market price by that fixed amount? (e.g. 1% stop on $5 is 5c, price eventually increases to $5.50 but stop trails by 5c)


Also, if I want to dynamically adjust the trail do I have to give the order a unique name so NT knows which one I am referring to? Is this even possible?

Thanks!
BillyRayValentine is offline  
Reply With Quote
Old 10-05-2010, 11:24 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello BillyRayValentine,

Yes, this is how it works. It trails the last traded price by the specified percentage. As the market increases in your favor, the stop will also adjust.

You can dynamicaly adjust stops and targets. This reference sample helps with this:
Modifying the price of stop loss and profit target orders
NinjaTrader_RyanM is offline  
Reply With Quote
Old 10-05-2010, 01:50 PM   #3
BillyRayValentine
Junior Member
 
Join Date: Sep 2010
Location: London, UK
Posts: 18
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Ryan

With the Price option for setting stop price, can I pass in a variable or does a number (double) have to be implicitly specified? E.g can I pass into the SetTrailStop() command a variable which stores a stop value I am calculating elsewhere in my code?

Thanks
BillyRayValentine is offline  
Reply With Quote
Old 10-05-2010, 02:03 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Yes, you can use a variable for your stop price.

However, CalculationMode.Price doesn't make sense in terms of a trail stop, so you would want to use SetStopLoss() and specify your price with this method.
NinjaTrader_RyanM is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
commision as a percentage calin Miscellaneous Support 1 04-07-2010 06:30 AM
Investing a percentage of the whole account MasterSepp General Programming 8 10-01-2009 10:12 AM
Account Performance Percentage DangerBoy Miscellaneous Support 1 10-01-2009 04:54 AM
A percentage of a move stephenszpak Suggestions And Feedback 8 05-06-2009 08:18 AM
Percentage Change in MA Emil Zola Market Analyzer 1 05-10-2007 12:35 PM


All times are GMT -6. The time now is 04:26 AM.