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!
See more
See less

Partner 728x90

Collapse

Market Replay and Instance of an Object Null Errors

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

  • Spiderbird
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Spiderbird,

    Downloaded Market Replay data from NinjaTrader's servers has Level 2 Depth of Market for futures.
    Very cool! I'll check it out tomorrow. Thanks again Chelsea.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Spiderbird,

    Downloaded Market Replay data from NinjaTrader's servers has Level 2 Depth of Market for futures.

    Leave a comment:


  • Spiderbird
    replied
    Hi Chelsea,

    Do you know if that market data provided by NinjaTrader includes DOM or tick data? If so, that would be amazing.
    And yes, I'm aware of IB's lack of recording tick data. I've been recording market sessions ever since I found that out.

    Good news is that I figured it out!

    It had nothing to do with the code per se. It was actually where the strategy was being started from. If you right click on the volumetric chart you want to use for your strategy... select and enable your strategy... it works like charm. That's both with live market data and market replay.

    However, if you start the strategy from the Control Center and just select the security, the connection to use and other related parameters, it won't print anything and has null defined for all barsType data. I would have thought by simply pointing the strategy to the security in the Control Center that it would work. But nope! You have to enable the strategy on the actual volumetric chart you want the strategy to run.

    So there you go. Problem solved!

    Thanks again for your time and attention NinjaTrader_ChelseaB !

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello,

    The most popular futures and forex instruments are recorded on our market replay server and will usually have up to 90 days worth of data available.


    Note, this data can be played back, but does not load historically on a chart.

    If you broker is Interactive Brokers, then recording historical tick data would be necessary as historical tick data is not provided.

    Leave a comment:


  • Spiderbird
    replied
    Hi Chelsea!

    I'm using Market Replay data that I've recorded in previous sessions via NT/IB, utilizing the 'Playback Connection' within NT8. I'm pretty sure I have the option for recording ticks active, but I can record the market tomorrow and double check my settings.

    I can usually see all of the volumetric data from the NT guide example when I start the strategy in real time.

    For reference, I've usually recording market data to get the tick data I'm looking for in my charts. I'm normally using 20 tick charts to interact with the market.

    Are there other settings I should double check?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Spiderbird,

    Historical tick data is necessary for this indicator to load historically.

    Market Replay data are recordings used for the Playback connection.

    What connection are you connected to?
    You may not need to record either of these.

    Leave a comment:


  • Spiderbird
    replied
    Hi NinjaTrader_ChelseaB ! Good to see you again.

    And yes, I was a dummy. I had neglected to put the following code to null barsType. Here's the updated code:

    Code:
    // For our volumetric bars
    
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType
    = Bars.BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    
    [B]if (barsType == null)
    return;[/B]
    
    if (IsFirstTickOfBar) // If this is the first tick of a new bar, start all this material
    {
    That also means that my market recordings of the past didn't capture the proper data to show up in my output window. I thought I had, but maybe I didn't check something in the Market Data option window. I'll include a screenshot of what I have now.

    Click image for larger version

Name:	MarketPlayback_MarketData.png
Views:	184
Size:	28.5 KB
ID:	1192738

    Am I supposed to use Market Replay or Historical Data to show volumetric bar data in the output window? Historically I've always used the Market Replay option.

    Thanks again for your help!

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Spiderbird,

    Is barsType null?

    See the check for null in the code sample from the help guide.


    Do you have historical tick data downloaded for any days of historical data that is loading?

    Leave a comment:


  • Market Replay and Instance of an Object Null Errors

    Hi all!

    I'm running into an issue where some code I've been working on to display volumetric data is throwing up instance of an object errors in Market Replay. It's strange because the code seems to work just fine in a live trading environment, but not on a recorded one.

    Here's the specific code that's causing the problem:

    Code:
    protected override void OnBarUpdate()
    {
    
    if (Bars == null)
    return;
    
    
    // For our volumetric bars
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType barsType
    = Bars.BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
    
    
    Print("=========================================== ==============================");
    Print("Bar: " + CurrentBar);
    [B]Print("Trades: " + barsType.Volumes[CurrentBar].Trades);
    Print("Total Volume: " + barsType.Volumes[CurrentBar].TotalVolume);[/B]
    Print("=========================================== ==============================");
    
    }
    The two bolded lines above are what's causing the "Object reference not set to an instance of an object." error in Market Replay. How can I check to make sure they aren't null so it doesn't stop the strategy?

    I know it's probably something basic, but I'd rather check here than banging my head against the wall for another half hour.
    Thanks in advance for any advice or guidance! Feel free to send me off to a related URL to learn more if that's easier.

Latest Posts

Collapse

Topics Statistics Last Post
Started by SantoshXX, Today, 03:09 AM
0 responses
6 views
0 likes
Last Post SantoshXX  
Started by DanielTynera, Today, 01:14 AM
0 responses
2 views
0 likes
Last Post DanielTynera  
Started by yertle, 04-18-2024, 08:38 AM
9 responses
41 views
0 likes
Last Post yertle
by yertle
 
Started by techgetgame, Yesterday, 11:42 PM
0 responses
12 views
0 likes
Last Post techgetgame  
Started by sephichapdson, Yesterday, 11:36 PM
0 responses
2 views
0 likes
Last Post sephichapdson  
Working...
X