Object reference not set to an instance... - futures io
futures io



Object reference not set to an instance...


Discussion in NinjaTrader

Updated
    1. trending_up 2,845 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Object reference not set to an instance...

(login for full post details)
  #1 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

So, I created a painfully simple strat which utilizes nothing but the RSI. When I went to run it on my chart, I got this in the log: Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object.

I read somewhere that this had to do with nulls BUT here's my code:

 
Code
                            
if (entryOrder1 == null && RSI(71)[1] <= 30 && RSI(71)[0] > 30)        
    {
    
entryOrder1 EnterLong(DefaultQuantity"MyStrategy");
         } 
Opposite for shorts (using the 70 line).

It doesn't get much simpler than that. Also, after doing this, another one of my strats, with which I've never had a problem, starting throwing the same error. Does anyone know if anything else might be causing this? It's just plain weird.

Thanks,
Dave

Reply With Quote

Can you help answer these questions
from other members on futures io?
Experience with AGN (Introducing Broker)
Brokers
TradingView help in improving Anchored Vwap
Platforms and Indicators
Color templates for MT5 40 items
Platforms and Indicators
1 min chart v-shape scan help please
ThinkOrSwim
Time Segmented Volume
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
 traderwerks   is a Vendor
 
 
Posts: 693 since Jun 2009
Thanks: 435 given, 464 received



dsraider View Post
So, I created a painfully simple strat which utilizes nothing but the RSI. When I went to run it on my chart, I got this in the log: Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object.

I read somewhere that this had to do with nulls BUT here's my code:

 
Code
                            
if (entryOrder1 == null && RSI(71)[1] <= 30 && RSI(71)[0] > 30)        

    {
    
entryOrder1 EnterLong(DefaultQuantity"MyStrategy");
         } 

Thanks,
Dave

Nothing weird about it. Just look at you code at think about the sequence that things happen when your strat runs.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Thanks for your reply, traderwerks. Anymore detail on that, though? I haven't done anything different with this one than normal and I definitely don't understand why a strat that's been working perfectly for months suddenly throws an error message every time I try and load it.

Thanks again,
Dave

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 traderwerks   is a Vendor
 
 
Posts: 693 since Jun 2009
Thanks: 435 given, 464 received


dsraider View Post
Thanks for your reply, traderwerks. Anymore detail on that, though? I haven't done anything different with this one than normal and I definitely don't understand why a strat that's been working perfectly for months suddenly throws an error message every time I try and load it.

Thanks again,
Dave

I cannot tell you exactly because I just saw a code snippet. Whatever the problem is , just watch what you are doing with the entryOrder. Just walk through the Code and e answer should pop out.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

It was a (bad word here) Draw object.

Thanks for your help.

Dave

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Object reference not set to an instance...


Last Updated on July 30, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Your Charts Should Speak To You w/Bob Cometta

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts