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

How to tell on bootup if there is a connection, or pending connection?

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

    How to tell on bootup if there is a connection, or pending connection?

    I have an AddOn that loads a bunch of data from external SQL database into my NT App.....and depending on if there is a connection or not I need to load different data.

    On Startup...how can I tell if there is a Connection, either pending or connected?

    Because the No Connected / Not Connecting state would load different data.

    Thank you.

    #2
    this doesn't work to indicate no-connection

    if (Connection.Connections == null)

    this works for playback

    if (Cbi.Connection.PlaybackConnection != null)

    Comment


      #3
      Good reading here and here.

      Try something like,

      Code:
      if (Connection.Status == ConnectionStatus.Connected &&
          Connection.PriceStatus == ConnectionStatus.Connected)
          // you are fully connected
      else
          // not fully connected

      Comment


        #4
        You might want to try using this.

        The idea is that you would load your initial set of
        data at startup (depending on connected or not),
        just like you're doing now.

        But when the ConnectStatusUpdate event handler
        tells you that the connection is fully connected after
        your startup, you know you can safely load the
        connected set of data.

        That is,
        Whenever the event handler says you are fully connected,
        then you clear your current data and (re)load the connected
        data set from the database.

        Comment


          #5
          That helps, thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X