Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cascading Indicators with 2 Instruments or more

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

    Cascading Indicators with 2 Instruments or more

    Hi, I have a problem with cascading indicator not showing the correct value. It shows the value of the main chart price instead. By cascading, I mean the input of an indicator is another indicator.

    SomeIndicator1:
    Code:
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    			Add(instrumentB, PeriodType.Minute, 1);
                Overlay				= false;
    			CalculateOnBarClose = false;
            }
            protected override void OnBarUpdate()
            {
    			if (CurrentBars[0] < 390 || CurrentBars[1] < 390)
    				return;
                Plot0.Set((Closes[0][0]+Closes[1][0])/2);
            }
    SomeIndicator:
    Code:
            protected override void OnBarUpdate()
            {
            if (CurrentBar < 390 )
    				return;
    	double val = SomeIndicator1()[0];
    	Print(val);
            Plot0.Set(val);
            }
    However, if SomeIndicator1 does not use 2 instruments, it works okay. Am I doing something wrong here?

    PS: the
    Code:
    if (CurrentBars[0] < 390 || CurrentBars[1] < 390)
    is needed to ensure both instruments have at least 1 full day of minute bars.

    Thank you in advance.

    #2
    Hi,

    it Seems that CurrentBars[1] is always return value of 1 (or other small integer).
    Isn't this supposed to increase as time passes by?

    Comment


      #3
      Please try removing any CalculateOnBarClose hardcoded reference in your called indicators.

      I just printed CurrentBars in a MultiSeries indicator and it's working here as expected for me, returning the CurrentBar count for both series for example.

      Are you on the latest B18?

      Thanks

      Comment


        #4
        Hi, I don't know how to explain this. But after a restart, it is now displaying the correct value. I didn't even have to remove CalculateOnBarClose .

        Yes, I'm on the latest B18.

        Next time I encounter inconsistency, I'll try restarting first before posting. Thanks

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        603 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        349 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        104 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        560 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X