Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
OnMarketData
Collapse
X
-
OnMarketData
I am using multi instruments in my code. My question is, Will the OnMarketData() method fire everytime ANY instruments bid/ask data changes, or will it only fire when the main instruments bid/ask data changes?Tags: None
-
It will whenever any instrument has a change.
Here is info from the help guide that will be useful for you.
1. With multi-time frame and instrument strategies, OnMarketData will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument.Josh P.NinjaTrader Customer Service
-
-
Hello everington_f,
Thanks for your post.
Josh's link from 2008 is outdated, here is the updated link: http://ninjatrader.com/support/helpG...nstruments.htm
In review of the helpguide section of OnMarketData: http://ninjatrader.com/support/helpG...marketdata.htm you will find the following notes and tips:
This is a real-time data stream and can be CPU intensive if your program code is compute intensive (not optimal)
This method is not called on historical data (backtest)
With multi-time frame and instrument strategies, OnMarketData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument. (BarsInProgress will return the first BarsInProgress series that matches the instrument for the event)
Do not leave an unused OnMarketData() method declared in your NinjaScript object. This will unnecessarily attach a data stream to your strategy which uses unnecessary CPU cycles.
Should you wish to run comparisons against prior values you will need to store and update local variables to track the relevant values.
With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa.Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by inanazsocial, Today, 01:15 AM
|
1 response
5 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
6 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
1 view
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
Comment