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.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      64 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      94 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      51 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      108 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      63 views
      0 likes
      Last Post PaulMohn  
      Working...
      X