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:
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,606 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    8 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    13 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X