• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Price data on more than one instrument

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Price data on more than one instrument

    I'm wondering if NinjaScript can see current bid/ask on any other instrument? For example I trade DAX and want quotes on S&P to be taken into account.

    #2
    Hello alexeymarvel,

    A non coding solution is to pull up multiple Superdom windows for each instrument that you want to view bid / ask data for.

    Yes, this is possible in our multiseries NinjaScript framework. You can add additional instruments in the Initialize method. There are a couple ways to access bid/ask for multiple series in real time. The methods GetCurrentBid() and GetCurrentAsk() will accept an input for the BarsInProgress that you want to access.

    You can also work in the OnMarketData stream for more control. To access real time bid / ask data for secondary instruments, you filter the specific BarsInProgress within the OnMarketData() handler.

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (BarsInProgress == 0)
    //Handle primary series bid/ask here.

    if (BarsInProgress == 1)
    //Handle secondary series bid/ask here.
    }

    The basic structure for multiseries scripts is available in all nt installations. To view: Click Tools > Edit NinjaScript > Strategy > SampleMultiInstrument. It's also documented here:
    http://www.ninjatrader.com/support/h...nstruments.htm
    Ryan MNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alfonso, Today, 10:21 AM
    0 responses
    1 view
    0 likes
    Last Post alfonso
    by alfonso
     
    Started by saeed, Today, 10:20 AM
    2 responses
    4 views
    0 likes
    Last Post NinjaTrader_RyanS  
    Started by ntbone, Yesterday, 05:21 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by ntbone, Yesterday, 04:05 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by tonynt, Today, 09:35 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Working...
    X