- ago
Hi,
I am running two strategies in streaming mode: once a minute, once every 10 seconds
I need to pass all Execute() calls in the 10s strategy when it is called while the minute strategy is running.
The 10s strategy checks a global Boolean during init which is set by the minute strategy.
If it finds the minute strategy is running then it needs to skip all execute calls at that 10s point.
(If 10s and minute Executes are both executing the Windows 10 file system does not release a file in time which causes an error.)
Is there a way to do this?
I saw pre and post execute sections in discussions.
For xample if code could jump from init to post execute.
Then there is the issue of how to define a goto label outside of init, execute, post.
Thanks!
0
104
1 Replies

Reply

Bookmark

Sort
Cone8
 ( 2.02% )
- ago
#1
Your design is too complicated and can't be synchronized that way.

For the 10-sec Strategies to skip the run at 1-minute in real-time, I'd just do this - no globals or any sync required.

CODE:
public override void Execute(BarHistory bars, int idx) {          int seconds = DateTime.Now.TimeOfDay.Seconds;          if (seconds > 55 || seconds < 5 )             return;                       //.. more code }
0

Reply

Bookmark

Sort