Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot stop DataSeries values from Strategy

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

    Plot stop DataSeries values from Strategy

    I have custom stop loss logic that I want to display on the backtest charts whenever I am holding a position.

    Based on what I've read I can't put these data in a DataSeries and display that on the chart as a curve.

    However I don't think I can implement the logic as an Indicator because it needs to know that when the strategy is not in a position it should not display values (i.e., it should be DataSeries.Reset for those bars).

    What is the best solution to display this stop curve?

    #2
    Hello dbooksta,

    Thank you for your post.

    I do not see why you could not create this as an indicator and have it plot on the chart. Can you provide an example that you have attempted that does not work?

    Comment


      #3
      Maybe I can. Can an Indicator get Position.AvgPrice and Position.MarketPosition from a Strategy that instantiates it?

      Comment


        #4
        Hello dbooksta,

        Thank you for your response.

        That would be a good example that would not work unfortunately. The Indicator could not access those values and thus if the Stop Loss is based on that value we could not track it.

        You can however set up the plot via the strategy and pass it to the indicator as seen in our SampleStrategyPlot reference sample at the following link: http://www.ninjatrader.com/support/f...ead.php?t=6651

        Comment


          #5
          That example explicitly says it won't work for backtesting, which is what I want this feature for.

          Comment


            #6
            That would be unfortunately correct in understanding dbooksta, although backtesting from regular charts would show those plots normally. As alternative for debugging you could for example use Draw methods to show the levels, although I would limit to debug use as ample of those objects would carry a performance impact.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            60 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X