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