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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-09-2010, 12:59 PM   #1
billr
Senior Member
 
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
Default Plot line for Stoploss

I have a strategy that has a price modification feature for the StopLoss and I would like to have a horizontal line plotted at the stop level and updated as the stop changes. (only a single line at any one time that is at the latest stop level, not multiple lines) How would that be done? Thanks.
Last edited by billr; 08-09-2010 at 01:01 PM.
billr is offline  
Reply With Quote
Old 08-09-2010, 01:36 PM   #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 billr,

Your StopLoss can use a variable for its level. Your line can also use a variable. If you use the same variable name for each then it's drawn at the same level. Below are links to method signatures for stop losses and horizontal lines.

http://www.ninjatrader-support.com/H...ontalLine.html
http://www.ninjatrader-support.com/H...tStopLoss.html

Set the Y value for the horizontal line to the same value as your stop loss. If you're not using mode price for your stop loss than you'll have to calculate these values manually.

Place the DrawHorizontal line in the same block that places your entry orders.

You can see this reference sample for help with monitoring stop loss and target orders:
http://www.ninjatrader.com/support/f...ead.php?t=5790

You could then monitor for when status is filled and then use RemoveDrawObject() to remove your line.
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
plot dash line velocity General Programming 3 12-17-2009 07:22 AM
Trying to Plot Line in Strategy yamdigger Strategy Development 2 05-27-2009 11:17 AM
Plot horizontal line ssg10 General Programming 1 05-13-2009 05:54 AM
Line Plot velocity General Programming 10 05-07-2009 05:59 AM
Plot Line Length ozfader General Programming 3 07-12-2008 11:39 PM


All times are GMT -6. The time now is 10:42 PM.