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

connection lost - alert!

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

    connection lost - alert!

    Today my Kinetick stops sending data at 11,30. I ve just noticed it 1,30 hours after.
    Is there any alert (email,etc) that I can use to alert me about that?
    It could be even on script level.

    #2
    Hello dafonseca,


    You could create a custom strategy to alert you in the event of a disconnection by using OnConnectionStatus().
    The method parameter ConnectionStatus. Disconnected can be used to return the disconnected statues and allow to set an action to take place at the onset of the disconnection.


    I have included the OnConnectionStatus() Help Guide to assist you further.
    Shawn B.NinjaTrader Customer Service

    Comment


      #3
      Can I use this script in one of my current strategies? Or you advice use a strategy only for this?
      another question would be:
      protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
      {
      dataFeed = priceStatus;
      }

      how can I check dataFeed (if) to send me an email in case os disconnection?
      what priceStatus would return?

      Comment


        #4
        Hello dafonseca,

        You could use the OnConnectionStatus() method in a separate strategy or along with an existing strategy.


        To send an email from the strategy, ensure you have configured the SMTP outgoing mail server to use your own ISP's mail server. You can set this information via the Control Center window Tools > Options > Misc.


        PriceStatus will return the status of the price server.


        I have included the SendMail() and Email SMPT SetupsHelp Guide to assist you further.


        Here is an example below:
        Code:
        [COLOR=#000000][FONT=Tahoma][LEFT][FONT=Courier New][SIZE=2][COLOR=#0000FF]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ConnectionStatus dataFeed = ConnectionStatus.Connected;[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2]
        [/SIZE][/FONT]
        
        
        [FONT=Courier New][SIZE=2][COLOR=#0000FF]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000FF]override[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000FF]void[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2]{  dataFeed = priceStatus;[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000FF]if[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] (dataFeed != ConnectionStatus.Connected)[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2]   SendMail([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000] "From email address"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"To email address"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] , [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Email Alert"[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2], [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Connection Lost!"[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2]}[/SIZE][/FONT][/LEFT]
        [/FONT][/COLOR]
        [COLOR=#000000][FONT=Tahoma]
        [/FONT][/COLOR]
        Shawn B.NinjaTrader Customer Service

        Comment


          #5
          Interesting.
          I am working connected with Kinetick (primary) and with IB,,,
          the method will email me when Kinetick lose coneection only, am i right?

          Comment


            #6
            Hello dafonseca,


            Yes, if Kinetick is your primary data feed, then your actions will trigger when it is disconnected.


            You will be alerted whenever the primary data feed of the strategy on your chart using the OnConnectionStatus() is running on is disconnected.
            Shawn B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by funk10101, Today, 12:02 AM
            0 responses
            3 views
            0 likes
            Last Post funk10101  
            Started by gravdigaz6, Yesterday, 11:40 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by MarianApalaghiei, Yesterday, 10:49 PM
            3 responses
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by XXtrader, Yesterday, 11:30 PM
            0 responses
            4 views
            0 likes
            Last Post XXtrader  
            Started by love2code2trade, 04-17-2024, 01:45 PM
            4 responses
            28 views
            0 likes
            Last Post love2code2trade  
            Working...
            X