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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          55 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          73 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          38 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          99 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          60 views
          0 likes
          Last Post PaulMohn  
          Working...
          X