Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Prevent plotting session jumps

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

    Prevent plotting session jumps

    Hi,

    I was wondering how I would be able to prevent an overlay indicator line to draw between sessions. So right now I have a line that jumps between sessions. I would be nicer if it just ends end the end of a session and then draws a new line at the beginning of a new session. In stead of trying to continue drawing which makes the session-breaks jump the line vertically.

    Thanks.

    #2
    siroki, are those plots currently? Then for example you could look into changing the style to a dot or hash that would not be connecting the segments, like a line or square style would in contrast.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Just set the color for the first bar of the session to transparent, if the plot style is line or square. Here is are some line applied to the first plot Plots[0].

      Code:
      #region Variables
            .....
            private bool drawGap = false;
            .....
      #endregion
      
      protected override void OnStartUp()
      {
                 .....
                 drawGap = (Plots[0].PlotStyle == PlotStyle.Line) || (Plots[0].PlotStyle == PlotStyle.Square);
      }
      
      protected override void OnBarUpdate()
      {
                 .....
                 if (drawGap & Bars.FirstBarOfSession)
                             PlotColors[0][0] = Color.Transparent; 
      }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X