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

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 Barry Milan, Today, 10:35 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by WeyldFalcon, 12-10-2020, 06:48 PM
        14 responses
        1,427 views
        0 likes
        Last Post Handclap0241  
        Started by DJ888, Yesterday, 06:09 PM
        2 responses
        9 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        40 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Today, 08:51 AM
        2 responses
        16 views
        0 likes
        Last Post bill2023  
        Working...
        X