Announcement

Collapse
No announcement yet.

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 yodaler, Today, 06:12 PM
      0 responses
      5 views
      0 likes
      Last Post yodaler
      by yodaler
       
      Started by op1031, Today, 05:16 PM
      0 responses
      1 view
      0 likes
      Last Post op1031
      by op1031
       
      Started by fscabrera03, Today, 01:18 PM
      1 response
      12 views
      0 likes
      Last Post fscabrera03  
      Started by BottomShark77, Today, 12:20 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by bowling, Today, 06:16 AM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Working...
      X