Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show indicator on strategy

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

    Show indicator on strategy

    Hi

    On my strategy I'm using custom indicators. However those indicators are not shown on the chart.
    Is there a way to make them show? (besides placing them manually)

    10x

    #2
    Yes kiss987, your strategy script could Add() them as well for visualization as shown in our tip here - http://www.ninjatrader.com/support/f...ead.php?t=3228

    Comment


      #3
      Thank you for your reply. I have another question which might be connected to your answer.

      On my custom indicator i expose public methods and members. Their values are calculated on the indicator's OnBarUpdate method and their values can be changed on each tick. (The indicator's data series are not that important).
      From my strategy's OnBarUpdate I want to access those methods and members AFTER they have been calculated on the current tick. My indicator always receives same values on his constructor's parameters.

      What is the best way to do so? Add the indicator on the strategy Initialize? Use the Update Method on the strategy's OnBarUpdate?
      Can you please please add a short code sample assuming my indicator looks like that:

      MyInd(p1, p2);
      double d1 = MyInd.MyMember;
      double d2 = MyInd.MyMethod();

      Comment


        #4
        You would need to call Update() before returning the exposed variable like shown here - http://www.ninjatrader.com/support/f...ead.php?t=4991

        For a series this would not be needed.

        Comment


          #5
          Is this the way to do so:

          MyInd _MyInd;

          protected override void Initialize()
          {
          _MyInd = MyInd(p1, p2);
          }

          protected override void OnOrderUpdate(IOrder order)
          {
          _MyInd.Update();
          double d1 = MyInd.MyMember;
          double d2 = MyInd.MyMethod();
          }

          Comment


            #6
            Originally posted by kiss987 View Post
            Is this the way to do so:

            MyInd _MyInd;

            protected override void Initialize()
            {
            _MyInd = MyInd(p1, p2);
            }

            protected override void OnOrderUpdate(IOrder order)
            {
            _MyInd.Update();
            double d1 = MyInd.MyMember;
            double d2 = MyInd.MyMethod();
            }
            The better way may be to include the Update(); as part of the getter for the variables for the indicator that you are calling. That ensures that the Update() is specific to the variable that you are accessing.

            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