Sending an Interrupt (e.g. Interval Message) in Replay

Custom indicators, trading strategies, data export and recording and more...
rickbarlow
Posts: 43
Joined: Mon Feb 08, 2021 5:37 pm
Been thanked: 1 time

Sending an Interrupt (e.g. Interval Message) in Replay

Post by rickbarlow » Sat Oct 09, 2021 7:32 pm

Not sure it is possible, but maybe you know a way to do the following:

After replaying a data feed file with my addon indicator on, I have graphic icons visible the screen that were created by my addon. I also have a feature which allows me to remove any/all of the visible graphic icons. I do that to remove things that are put on the screen that I want to see and mentally process, but later want to remove to avoid so much clutter. But the way I do that right now is by calling a function periodically in the onInterval() callback. It works great!
However, when running in replay mode, after the feed is fully processed and sitting on my screen, I no longer have a way to run my function to remove the icons, because I no longer have a way to get an interval message (e.g.interrupt). Do you know if there is any way that I can trigger an interval message, or any other message type in callback mode, after it has completed the file reload?
Thanks
 

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Sending an Interrupt (e.g. Interval Message) in Replay

Post by Andry API support » Mon Oct 11, 2021 4:33 pm

Hi,
The first case was (I guess so) loading some historical data in live mode. In live mode the timeline never ends (OK, until the symbol is unsubscribed) and the clock ticks on and onInterval gets triggered.
The second case was in replay where the timeline is finished. Once the feed is fully processed the timeline comes to an end so the clock stops ticking and onInterval is no longer triggered.
If you need something calling your methods periodically you may want to use a ScheduledExecutorService instance. Here are some examples. Just do not forget to shut the service down once your strategy gets stopped.

rickbarlow
Posts: 43
Joined: Mon Feb 08, 2021 5:37 pm
Been thanked: 1 time

Re: Sending an Interrupt (e.g. Interval Message) in Replay

Post by rickbarlow » Thu Nov 04, 2021 4:50 pm

Thank you for pointing me in a direction!!

Post Reply