![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
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);
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
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?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
|
either way would work for me
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You currently cannot modify orders through draw objects. Thank you for the suggestion. We will add it to the list of future considerations.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
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...
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |