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

how to call indicator from indicator

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

    how to call indicator from indicator

    I know have some function like :
    AddChartIndicator called in State == State.DataLoaded

    However, this is only work for using strategy to call indicator.

    What i want is called indicator from indicator.

    #2
    Hello cincai,
    You can do as below:
    1. Before OnStateChange(), private SMA sma1;
    2. In DataLoaded, sma1 = SMA(Period);
    3. In OnBarUpdate(), now you can use as required. Example - Plot1[0] = sma1[0]; // this will plot SMA
    Hope it helps!

    Comment


      #3
      Hello cincai,

      Thanks for your post.

      For indicators, there is not an AddChartIndicator() method. Just to clarify, AddChartIndicator() is a convenience method for the purpose of adding indicators to a chart when a strategy is loaded. The strategy does not have to use the indicator within the strategy (typically they do).

      As forum member s.Kinra advised, in order to see a plot from another indicator, in an indicator, you would have to create a plot for it and assign the indicator value to it. You would create a private instance of the indicator, initialize the indicator in state.DataLoaded and in OnBarUpdate() assign the indicator value to the plot you created.
      Paul H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      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
      15 views
      0 likes
      Last Post bill2023  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      167 responses
      2,260 views
      0 likes
      Last Post jeronymite  
      Started by warreng86, 11-10-2020, 02:04 PM
      7 responses
      1,362 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Perr0Grande, Today, 08:16 PM
      0 responses
      5 views
      0 likes
      Last Post Perr0Grande  
      Working...
      X