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 geddyisodin, Today, 05:20 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by bmartz, Today, 09:30 AM
          2 responses
          12 views
          0 likes
          Last Post bltdavid  
          Started by f.saeidi, Today, 11:02 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          4 responses
          12 views
          0 likes
          Last Post geotrades1  
          Started by rajendrasubedi2023, Today, 09:50 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X