Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TimeSpan

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

    TimeSpan

    Hello,
    I want to filter a time zone so that it can give me an instruction. It works well for me but if I want to change the schedule I have no problems but when I close the ninja and reopen it it does not keep that last change, it always starts with the values ​​that I have by default in the variables. I have put them in the state. SetDefaults, I have set them outside and nothing. In the value properties I have now put [XmlIgnore()] but nothing. Can you help me?

    TimeSpan horaInicio = new TimeSpan(00, 00, 00) ;
    TimeSpan horaFin = new TimeSpan(23, 59, 59) ;​

    #2
    Hello anmir55,

    You will need to serialize the input with a public string.

    Below is a link to a forum post with sample code.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I think I have it in a public variable...​

      [XmlIgnore()]
      [NinjaScriptProperty]
      [Display(Name="Hora de Inicio", Description="Hora de inicio de la franja horaria", GroupName="Plots", Order=6)]
      public TimeSpan HoraInicio
      {
      get { return horaInicio; }
      set { horaInicio = value; }
      }

      [XmlIgnore()]
      [NinjaScriptProperty]
      [Display(Name="Hora de Fin", Description="Hora de fin de la franja horaria", GroupName="Plots", Order=7)]
      public TimeSpan HoraFin
      {
      get { return horaFin; }
      set { horaFin = value; }
      }​

      Comment


        #4
        Hello anmir55,

        You will need to serialize the input with a public string.

        From the sample code in the forum post I have linked you.

        [XmlIgnore]
        public TimeSpan OpenTime { get; set; }

        [Browsable(false)]
        public string OpenTimeSerialize
        { get { return OpenTime.ToString(); }
        set { OpenTime = TimeSpan.Parse(value); } }​
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Sorry, now it works, thank you very much for your help

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          332 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X