Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling an Indicator that uses OnMarketData from within another indicator

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

    Calling an Indicator that uses OnMarketData from within another indicator

    Hi,
    Background:

    I am aware of how to call an indicator from within another indicator. e.g.

    ---------------------------
    public class Sim22_DeltaV3 : Indicator
    {
    private Sim22.Gapless.Sim22_EmaGaplessV2 emaGapless;
    .
    .
    .

    if (State == State.Configure)
    {
    emaGapless = Sim22_EmaGaplessV2(Values[1], PeriodEma, DeltaGaplessEmaType);
    .
    .
    .
    Values[0][0] = emaGapless[0]; = emaGapless[0];
    ------------------------

    My question is is this not supposed to work when the called indicator uses OnMarketData and would require TickReplay to be enabled , even though TickReplay is enabled on the chart. Another point is that the called indicator used Lists to store OnMarketData values like an OrderBook list.

    I am trying to achieve a divergence indicator with RSI(for example), where the price is compared to the indicator value and noted.

    If calling the indicator is not right way, I am also open to have a public variable(or similar) which stores the called indicator value and can be accessed by calling indicator in realtime.

    I hope I am making sense.

    Thanks,

    SDG


    #2
    Hello SuperDriveGuy,

    From what is provided I really couldn't provide an expectation of what should/should not work as this is a custom script. I can say that calling a secondary indicator in a simple test does invoke the OnMarketData in historical for the hosted script.

    You do need to program the host and hosted scripts for TickReplay, have you followed the steps in the help guide for Calling a Tick Replay indicator from another Indicator or Strategy? There is a sample in the following page which shows the required syntax, you absolutely need to store the indicator as a variable from State.DataLoaded. Beyond that, it would be up to the hosted indicator if it will work in that situation. I can suggest making a more simple test with two dummy indicators and Prints to confirm you are calling it correctly, then retry that with the custom indicator.




    A hosting indicator or strategy must be aware of the requirement to run through another indicator's historical Tick Replay data before it reaches State.Historical. To achieve desired results, you either need to store the reference in State.DataLoaded or (for a strategy) you can call AddChartIndicator().



    I look forward to being of further assistance.


    Comment


      #3
      Thanks Jesse.

      I will try your suggestion and strip down the logic to bare bones and report back.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      344 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
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      557 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X