NinjaTrader Support Forum  

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 03-01-2009, 03:45 PM   #1
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default Target Profit/Stoploss Horizontal Lines

is there a code to have lines set to adjust Target Profit/Stoploss orders like "Chart trader"? Not looking for all the details that Chart trader plots...but would be nice

Code:
if
(Position.MarketPosition == MarketPosition.Long)
{
DrawHorizontalLine("long stop" ,Position.AvgPrice - (stop_ticks* TickSize),Color.Pink,DashStyle.Dot,2);
DrawHorizontalLine("long tp" ,Position.AvgPrice + (tp_ticks * TickSize),Color.PaleGreen,DashStyle.Dot,2);
} 
duck_CA is offline  
Reply With Quote
Old 03-02-2009, 07:34 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi duck_CA, are you looking for code to visualize your strategies stop and target levels while running? Or are you looking to modify your strategy orders by dragging and dropping those horizontal lines?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-02-2009, 04:04 PM   #3
duck_CA
Senior Member
 
Join Date: Jan 2008
Location: sacramento CA
Posts: 181
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Yahoo to duck_CA Send a message via Skype™ to duck_CA
Default looking to adjust target/stop loss levels

either way would work for me
duck_CA is offline  
Reply With Quote
Old 03-02-2009, 04:09 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

You currently cannot modify orders through draw objects. Thank you for the suggestion. We will add it to the list of future considerations.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-10-2009, 07:42 PM   #5
jdfagan
Senior Member
 
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
Default

Bertrand,

I'd be interested in best way to go about visualizing my stops (stop & profit stop). I was thinking of writing an indicator that accepts data series as inputs. And then use Add() within Strategy.Initialize() to add this indicator to the strategy, and pass it some data series that would represent the stop values over time (sometimes it would be null when not in a trade). The strategy would then update the underlying DataSeries objects it passed into the indicator via OnBarUpdate, etc. as the trade position state changed.

Would this be the best way to go about solving this? Or do you have a sample that illustrates a way to achieve this visualization of values modified within a strategy?

Thanks,

JD
jdfagan is offline  
Reply With Quote
Old 03-11-2009, 07:31 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi JD, the easiest way would be to use Draw methods directly from the strategy to visualize the levels. Just make sure you use unique tags if you need to see also the past levels...
NinjaTrader_Bertrand 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
Horizontal Lines BrandonLG83 Charting 4 02-10-2009 09:47 PM
Trailing Stop, StopLoss, Profit Target Combo Bannor Strategy Development 16 12-23-2008 11:29 AM
Profit Target and Stoploss Razor_Trader Strategy Development 2 06-10-2008 02:51 PM
Horizontal Lines ale la juve ale Charting 1 03-25-2008 09:55 PM
Horizontal Lines guym Suggestions And Feedback 2 12-07-2006 08:32 AM


All times are GMT -6. The time now is 04:32 PM.