Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

custom Dataseries as indicator input, or input to indi through underlying strategy

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

    custom Dataseries as indicator input, or input to indi through underlying strategy

    Hi!

    I would like to write an Indicator to display various things that can only accessed from within a strategy.
    e.g.
    Position.Quantity,
    Performance.AllTrades.Performance.Currency.CumProf it,
    Position.GetProfitLoss(Close[0], PerformanceUnit.Currency),
    Performance.AllTrades.Performance.Currency.DrawDow n,
    etc.

    This values can be saved into a dataseries
    protected override void Initialize() {
    myPosSize = new DataSeries(this);
    DataSeries myPosSize = new DataSeries(this);
    *...something else* }

    Can this dataseries be passed to an indicator as input? How can I update / set a value in or through the OnBarUpdate() of the underlying strategy?

    Thanks for your help,
    Nathamus

    #2
    Yes these DataSeries objects can be passed into any method (Indicators are methods) that accepts a DataSeries object from within the OnBarUpdate() method however, this will not accomplish what I believe you want to do which is plot an equity curve (for example) of a strategy within a chart using an indicator. Correct?

    If I am correct, this is not supported at this time. I know users have plotted text on the chart (DrawText() methd) with performance data at key points on the chart.
    RayNinjaTrader Customer Service

    Comment


      #3
      Hello Ray,

      Originally posted by NinjaTrader_Ray View Post
      I believe you want to do which is plot an equity curve (for example) of a strategy within a chart using an indicator. Correct?
      Yes that is correct. I do not want to plot it as a overlay (otherwise I could plot from within the strategy, because the the PositionSize is small in comparison to the equity price). Sorry, I did not get the point why this should not be possible.

      A dataseries can be created in the strategy that holds the current PositionSize or PnL or whatever. How can this DataSeries be passed as an input to an Indicator?

      private DataSeries myPosSize;

      protected override void Initialize()
      {
      myPosSize = new DataSeries(this);
      Add(MyIndicatorPlotingThePosSize(myPosSize)
      ...
      }

      protected override void OnBarUpdate()
      {
      myPosSize.Set(Position.Quantity);
      ...
      }

      Originally posted by NinjaTrader_Ray View Post
      Yes these DataSeries objects can be passed into any method (Indicators are methods) that accepts a DataSeries object from within the OnBarUpdate() method ...
      How can the values from a custom data Series that I just passed be accessed from within an indicator?

      protected override void OnBarUpdate()
      {
      Plot0.Set(Input[0]);
      }

      Thanks for your help,
      Nathamus

      Comment


        #4
        In theory, your approach might make sense however, this is not supported and would likely not work.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X