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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      591 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      553 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X