bypass Onstartup code when no connection - NinjaTrader Programming | futures io social day trading
futures io futures trading


bypass Onstartup code when no connection
Updated: Views / Replies:513 / 9
Created: by vantojo Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

bypass Onstartup code when no connection

  #1 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

bypass Onstartup code when no connection

Sometimes I don't automatically connect to a provider when Ninja starts up.

But I still have workspaces that open charts with indicators.

In this case I would like to bypass some code in OnStartup. (when there is no connection, or ninja starts with no connection)

Any ideas?

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

for NT7


this is for NT7

Reply With Quote
 
  #4 (permalink)
Market Wizard
Germany
 
Futures Experience: Intermediate
Platform: Other
Favorite Futures: ES, YM, 6E
 
Posts: 2,640 since Feb 2013
Thanks: 4,896 given, 6,424 received
Forum Reputation: Legendary

See the OnConnectionStatus() method.
You can switch your code on/off accordingly.

Reply With Quote
 
  #5 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

thks

OK, it looks like it should work, but I get this compile message... (it is in a working indicator that otherwise compiles normally)

'NinjaTrader.Indicator.AANews.OnConnectionStatus(NinjaTrader.Cbi.ConnectionStatus, NinjaTrader.Cbi.ConnectionStatus)': no suitable method found to override

===============================================================================

bool connected = false;


#region OnConnectionStatus
protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
{
if (priceStatus = ConnectionStatus.Connected)
connected = true;
else
connected = false;
}
#endregion

===========================================================================

not finding much on the web for this error

Reply With Quote
 
  #6 (permalink)
Market Wizard
Germany
 
Futures Experience: Intermediate
Platform: Other
Favorite Futures: ES, YM, 6E
 
Posts: 2,640 since Feb 2013
Thanks: 4,896 given, 6,424 received
Forum Reputation: Legendary

See OnConnectionStatus no suitable method found to override - NinjaTrader Support Forum .

P.S.: It boils down to the fact that you have to trigger your indicators from a strategy.

Reply With Quote
 
  #7 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

any other ideas?

Ok, then that method won't work for me because these are chart indicators not used in any strategy....

any other ideas?

Reply With Quote
 
  #8 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

might work

this is not instantiated in OnStartUp when there is no connection....

Bars.MarketData.Connection.Options.Provider

if I check it for null, it tells me it is a non-nullable field....

how can I tell if it is instantiated (I'm not a C# guru...)

If it is not instantiated then I know there is no connection and I can bypass the code I want...

Thanks!

Reply With Quote
 
  #9 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

mistake

OK, it can be compared to null....

but it is not instantiated so I get a run error "Object reference not set to an instance of an object" when comparing (==) to null

ideas?

Reply With Quote
 
  #10 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received



vantojo View Post
OK, it looks like it should work, but I get this compile message... (it is in a working indicator that otherwise compiles normally)

'NinjaTrader.Indicator.AANews.OnConnectionStatus(NinjaTrader.Cbi.ConnectionStatus, NinjaTrader.Cbi.ConnectionStatus)': no suitable method found to override

In an indicator you have to attach your own callback in OnStartup to get access to the same functionality:

 
Code
NinjaTrader.Cbi.Globals.Connections.ConnectionStatus += new ConnectionStatusEventHandler(OnConnection);

Check the 'private void OnConnection' code in the 'Accounts and Executions' section of ChartMinder if needed, but a cut down example is:

 
Code
		private void OnConnection (object sender, ConnectionStatusEventArgs e)
		{
				if (e.Status == ConnectionStatus.Connecting)
				{

				}
				else if (e.Status == ConnectionStatus.Connected)
				{

				}
				else if (e.Status == ConnectionStatus.ConnectionLost || e.Status == ConnectionStatus.Disconnected)
				{

				}
		}

You also need to disconnect the handler in OnTermination:

 
Code
NinjaTrader.Cbi.Globals.Connections.ConnectionStatus -= new ConnectionStatusEventHandler(OnConnection);

Cheers

Travel Well
Reply With Quote
The following 3 users say Thank You to ratfink for this post:

Reply



futures io > > > > > bypass Onstartup code when no connection

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vladimir Putin signs historic $20bn oil deal with Iran to bypass Western sanctions kbit News and Current Events 0 August 7th, 2014 10:12 PM
Hackers bypass online security at 34 banks kbit News and Current Events 0 July 22nd, 2014 08:53 PM
OnStartUp error Ragdoll NinjaTrader Programming 15 September 17th, 2013 05:17 PM
U.S. lets China bypass Wall Street for Treasury orders kbit News and Current Events 0 May 21st, 2012 04:50 PM
New OnStartUp() method in NT7 B8 aslan NinjaTrader Programming 7 February 5th, 2010 10:47 AM


All times are GMT -4. The time now is 09:03 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-11 in 0.12 seconds with 19 queries on phoenix via your IP 54.83.122.227