[SIZE=2][FONT=Courier New][COLOR=#0000ff]if[/COLOR][/FONT][/SIZE] [FONT=Courier New][SIZE=2](Position.MarketPosition == MarketPosition.Long)[/SIZE][/FONT] [SIZE=2][FONT=Courier New]{[/FONT][/SIZE] [SIZE=2][FONT=Courier New]DrawHorizontalLine([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"long stop"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ,Position.AvgPrice - (stop_ticks* TickSize),Color.Pink,DashStyle.Dot,[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT] [SIZE=2][FONT=Courier New]DrawHorizontalLine([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"long tp"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ,Position.AvgPrice + (tp_ticks * TickSize),Color.PaleGreen,DashStyle.Dot,[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT] [SIZE=2][FONT=Courier New]} [/FONT][/SIZE]
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Target Profit/Stoploss Horizontal Lines
Collapse
X
-
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:Tags: None
-
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
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ETFVoyageur, Today, 02:15 AM
|
1 response
14 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by lorem, 04-25-2024, 09:18 AM
|
21 responses
90 views
0 likes
|
Last Post Today, 07:20 AM | ||
Started by mlprice12, 12-21-2021, 04:55 PM
|
5 responses
309 views
0 likes
|
Last Post
by paypachaysa
Today, 07:19 AM
|
||
Started by Human#102, 05-08-2024, 09:54 AM
|
4 responses
18 views
0 likes
|
Last Post Today, 07:19 AM | ||
Started by ETFVoyageur, Today, 06:11 AM
|
1 response
9 views
0 likes
|
Last Post Today, 07:17 AM |
Comment