I've run the script before on tick replay with just the main chart instrument so I know the process generally works. Just wondering if there's anything special about multi-instrument scripts and tick replay
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Running a multi-instrument strategy on tick replay
Collapse
X
-
Running a multi-instrument strategy on tick replay
Just wondering if there are any special considerations to be aware of. I've downloaded each day of CL 06-23 and MCL 06-23 from 03/01/23 through April 21st. The strategy runs on CL and places trades on MCL. It runs without error in real time when market's open but when connected to market replay connection it craters with an error about no market data being available to place the order.
I've run the script before on tick replay with just the main chart instrument so I know the process generally works. Just wondering if there's anything special about multi-instrument scripts and tick replayTags: None
-
-
Ah never mind. Moved forward to another date and started there and it's working. Must have been something to do with the first start date of 3/1
Comment
-
Hmm... Do you mean to say one could benefit from also downloading the historical data in addition to the replay data then?
Comment
-
Well, for one thing, if your chart has let's say 5 days of data on it, when you start the replay, the historical data will be used to populate the chart before the moment the replay starts so your indicators can get set up and primed with the historical context. There are probably other reasons as well - I always get both.
Comment
-
Right so then I had the market replay running along happily for about a week when it disabled itself. Ran it again. Blew up at the same place. There's a line in the log referring to a database issue:
Looked back through the log and seems like this was happening quite a bit but it kept on going then suddenly it just sort of had enough and quit. In a way kinda reminds me of myself when I was younger actually.
Script didn't seem to have any errors in it that might have prompted such extreme frustration on the part of the database. There was a short position. It was politely suggested that it was no longer welcome, so it took the hint and exited peacefully. No drama there. Inserting 2 screenshots to show full width details
Last edited by markdshark; 04-22-2023, 04:40 PM.
Comment
-
Hey that worked! I got a week or so past the previous crash and logs no longer show that error.
I have a new problem though (that's just how it goes)
Apparently an indicator has a problem with how many brushes it's using. I get the error: Brush series exceeds the maximum number (65535) of unique brushes. Indicators and brushes are still new to me so I'll wrap up for the night and attack again tomorrow. Interestingly in realtime this error never cropped up. Then again I've never been able to (or frankly had any reason to) leave the script running for a week or more.
Thought I'd share the progress. Thank you for the pointers Bruce.
Comment
-
Hello markdshark,
Thanks for your posts.
QuantKey_Bruce is correct. Before using the Playback connection with Market Replay you should make sure that you have the Market Replay data you are accessing downloaded in the Historical Data window. It is also a good idea to download Historical data for the same instruments and timeframes.
Playback: https://ninjatrader.com/support/help...connection.htm
Downloading Market Replay data: https://ninjatrader.com/support/help...jaTraderserver
Further, instead of creating unique brushes each time you use them in OnBarUpdate(), OnRender(), and OnMarketData(), you could create a class-level Brush object, assign a value to it in something like State.DataLoaded, and call .Freeze() on the unique brush. That brush could then be used later in the script in OnBarUpdate(), OnRender(), or OnMarketData(). This will allow your script to use fewer resources when the script is running.
From the help guide: You may have up to 65535 unique Brush instances, therefore, using static predefined brushes (as in the section above) should be favored. Alternatively, in order to use fewer brushes, please try to cache your custom brushes until a new brush would actually need to be created.
See this help guide page for more information about working with brushes: https://ninjatrader.com/support/help...gcustombrushesLast edited by NinjaTrader_BrandonH; 04-23-2023, 03:36 PM.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Mountain_cast, 02-10-2025, 11:14 PM
|
3 responses
20 views
0 likes
|
Last Post
![]()
by beobast
Today, 05:30 PM
|
||
Started by defa0009, 12-13-2024, 09:19 AM
|
21 responses
209 views
1 like
|
Last Post
![]()
by marcus2300
Today, 05:08 PM
|
||
Started by ttrader23, Today, 04:48 PM
|
0 responses
6 views
0 likes
|
Last Post
![]()
by ttrader23
Today, 04:48 PM
|
||
Started by wisdomspoon, Today, 03:50 PM
|
3 responses
15 views
0 likes
|
Last Post
![]()
by rockmanx00
Today, 04:33 PM
|
||
Started by Robotman, Today, 01:06 PM
|
2 responses
37 views
0 likes
|
Last Post
![]()
by Robotman
Today, 02:05 PM
|
Comment