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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        129 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        74 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        117 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        111 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        89 views
        0 likes
        Last Post CarlTrading  
        Working...
        X