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!
See more
See less

Partner 728x90

Collapse

Target Profit/Stoploss Horizontal Lines

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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:
    [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]

    #2
    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?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      looking to adjust target/stop loss levels

      either way would work for me

      Comment


        #4
        You currently cannot modify orders through draw objects. Thank you for the suggestion. We will add it to the list of future considerations.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          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


            #6
            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...
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ETFVoyageur, Today, 02:15 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by lorem, 04-25-2024, 09:18 AM
            21 responses
            90 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by mlprice12, 12-21-2021, 04:55 PM
            5 responses
            309 views
            0 likes
            Last Post paypachaysa  
            Started by Human#102, 05-08-2024, 09:54 AM
            4 responses
            18 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by ETFVoyageur, Today, 06:11 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X