Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start of New Trading Session

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

    #16
    Chelsea,
    This is what I currently have. I didn't think the string needed to be serialized. It is not saving. I am a bit unsure where to start with getting it serialized.
    Thank you for any help or input.
    Regards,
    James

    if (State == State.SetDefaults)
    {
    Description = @" IntradayGapBars ";
    Name = "TOTgaps";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = false;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = false;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;




    // Default values for string inputs
    SessionStartTimeInput = "06:45"; // Default: 6:45 AM
    SessionEndTimeInput = "16:00"; // Default: 2:00 PM


    }
    else if (State == State.Configure)
    {


    // Convert string inputs to TimeSpan
    if (!TimeSpan.TryParse(SessionStartTimeInput, out SessionStartTime))
    throw new Exception("Invalid Session Start Time format. Use HH:mm.");
    if (!TimeSpan.TryParse(SessionEndTimeInput, out SessionEndTime))
    throw new Exception("Invalid Session End Time format. Use HH:mm.");


    // Properties
    // User-modifiable properties for session start and end times
    [NinjaScriptProperty]
    [Display(Name = "Session Start Time (HH:mm)", Description = "Start time of the session in HH:mm format", Order = 98, GroupName = "GapBars Data Series")]
    public string SessionStartTimeInput { get; set; }

    [NinjaScriptProperty]
    [Display(Name = "Session End Time (HH:mm)", Description = "End time of the session in HH:mm format", Order = 99, GroupName = "GapBars Data Series")]
    public string SessionEndTimeInput { get; set; }​

    Comment


      #17
      Hello laoshr,

      If you are putting in a time I would expect a TimeSpan object type..

      How do you know the string isn't being saved?

      Have you printed the string in State.Configure before attempting to parse it and this is an empty string?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Chelsea,
        Thank you again for pointing me in the right direction. I did what you said and it looks like it isn't being stripped. I also found the error. All is good. Thank you for all your time and help. I am very grateful for this forum and all those who help with moderating.
        Regards,
        James

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 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
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X