a way for the cBot to know in case an exception happened inside the indicator

Created at 08 Dec 2021, 10:45
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!
EY

eynt

Joined 08.05.2020

a way for the cBot to know in case an exception happened inside the indicator
08 Dec 2021, 10:45


My cBot uses a custom indicator. Is there a way for the cBot to know in case an exception happened inside the indicator? At the moment it keeps calling the Calculate method although the calling for the indicator is inside a try-catch block.

 

Thanks


@eynt
Replies

firemyst
22 Dec 2021, 10:10

Where do you call the indicator to get it's latest data?

OnBar? OnTick?

A submethod?

In there, you would put the call to get the latest data in a try-catch block. If there's an exception, you can either:

1) log it to the output and keep the cbot runnign

2) set a "flag" of some sort, stop the bot if the flag is set, or again just have it log to output.

It depends on what you need/want to happen.


@firemyst