Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disabling strategy event because of Data Connection loss

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

    Disabling strategy event because of Data Connection loss

    Hello,

    I'm having a hard time finding a suitable solution.
    I'm running a strategy which disable itself sometimes, due to some failure of the data stream of my broker.
    In fact it loses the data connection every day around 06:30 in the moring, sometimes for couple of minutes, but sometimes for more than 15 (which is too much)
    If it hits +15min it disables itself.
    How can I fetch this "disable" event?
    I tried the terminate but it did not suit the situation.
    PS I'm sending emails when events occure.

    All the best





    #2
    Hello fernlicht,

    Connection losses can be detected in OnConnectionStatusUpdate, but this would only be if the strategy is not disabled.
    https://ninjatrader.com/support/help...atusupdate.htm

    If the Strategy is disabled, only OnStateChange will run with State.Terminated.
    (You can use a bool that is set to true once the strategy reaches State.DataLoaded to know that the instance of the strategy was previously enabled)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I'm already using OnStateChange like you've described
      it sends me a mail but only if the strategy is closed means CTRL+W

      here the sample code
      .....
      else if (State == State.DataLoaded)
      {
      IsDisabled = true;
      }
      ........
      else if (State == State.Terminated)
      {
      if(IsDisabled == true && State == State.Realtime) // IsDisabled is uesed in DataLoded
      {
      SendTextMail("STRATEGY TERMINATED:");
      Print(Time[0]+" Strategy terminated");
      }
      }
      ......

      Comment


        #4
        Hello fernlicht,

        Other traders are finding success with this.
        https://ninjatrader.com/support/foru...gy-is-disabled

        However, the State will not be State.Reatime when the State is State.Terminated. That condition will never be true.
        The State property cannot have two values at the same time.

        With an indicator you could detect when the connection is re-established in OnConnectionStatusUpdate() and send an email then..
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by zacharydw00, Today, 05:14 PM
        0 responses
        5 views
        0 likes
        Last Post zacharydw00  
        Started by shahabjet1, Today, 04:47 PM
        0 responses
        10 views
        0 likes
        Last Post shahabjet1  
        Started by aligator, Today, 04:32 PM
        0 responses
        10 views
        0 likes
        Last Post aligator  
        Started by timko, Today, 04:02 PM
        0 responses
        9 views
        0 likes
        Last Post timko
        by timko
         
        Started by asmmbillah, Today, 03:37 PM
        2 responses
        18 views
        0 likes
        Last Post asmmbillah  
        Working...
        X