Bars.BarClosed event does not work when using dependent indicators

Created at 04 Nov 2023, 13:31
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
WO

wolters

Joined 25.03.2022

Bars.BarClosed event does not work when using dependent indicators
04 Nov 2023, 13:31


Hi.

It looks as if there is a problem using the BarClosed-Event.

I have an indicator ONE that calculates different parts during the BarClosed-Event.
I have an indicator TWO that makes use of indicator ONE. Both are using the BarClosed-Event. 

But now it looks as if the BarClosed-Event of indicator ONE is called AFTER the BarClosed-Event of indicator TWO. Therefore the calculations of Indicator ONE are not available at the time indicator TWO makes use of it.

How can I make sure that BarClosed-Event of indicator ONE is always called before BarClosed-Event of indicator TWO?

 

Best
Carsten


@wolters
Replies

PanagiotisCharalampous
06 Nov 2023, 07:07

Hi Carsten,

There is no way to force this so you should think of a different way to implement your functionality. Based on your abstract description, it seems more appropriate to create a method and call it whenever you want, instead of relying on events.

Best regards,

Panagiotis 


@PanagiotisCharalampous