I’ve uploaded 2 simple strategies.
1st strategy is, MyCustomStrategy80 uses a custom indicator (SQBBandWidthRatio) defined at the Class level, assigned at State.Dataloaded in the OnStateChange() event.
2nd strategy is MyCustomStrategy85 is a copy of MyStrategy80 BUT, the indicator is defined in-flight in the OnBarUpdate() event
Both strategies do the same trades, BUT their indicator is defined and assigned differently. Both scripts compile and executed properly.
I’ve also inserted a simple Print statement after every new bar in both scripts. This Print statement provides C# Timespan in milliseconds between each bar.
MyCustomStrategy80 execution was quick and normal with the following bar Prints
0ms 1/2/2017 7:00:00 PM: NEW Processing bar
0ms 1/2/2017 7:15:00 PM: NEW Processing bar
0ms 1/2/2017 7:30:00 PM: NEW Processing bar
0ms 1/2/2017 7:45:00 PM: NEW Processing bar
...
0ms 1/31/2017 4:00:00 PM: NEW Processing bar
0ms 1/31/2017 4:15:00 PM: NEW Processing bar
0ms 1/31/2017 4:45:00 PM: NEW Processing bar
23ms 1/2/2017 7:00:00 PM: NEW Processing bar
4ms 1/2/2017 7:15:00 PM: NEW Processing bar
4ms 1/2/2017 7:30:00 PM: NEW Processing bar
5ms 1/2/2017 7:45:00 PM: NEW Processing bar
...
19ms 1/31/2017 4:00:00 PM: NEW Processing bar
19ms 1/31/2017 4:15:00 PM: NEW Processing bar
21ms 1/31/2017 4:45:00 PM: NEW Processing bar
My question is, what needs to be defined to a custom indicator so that it can be defined in-flight at OnBarUpdate() event of a strategy so that the execution speed of the strategy returns back to normal with sub-millisecond time between bars ?
I’m converting my trading strategies to NT8 and they all define indicators in-flight / in-line with the OnBarUpdate() event, and they are all have this execution speed problem.
I wrote these test scripts for NT Support to replicate the error I see and to provide support.
Can you please take a look at the scripts and custom indicator and let me know what I need to define to the custom indicator so that execution of MyCustomStrategy85 will be quick and normal like MyCustomStrategy80.
Please let me know
Thank you
Comment