Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawning with Time X & Y

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

    Drawning with Time X & Y

    Hi, why does this simple code not work properly?

    if (
    ToTime(Time[0]) == ToTime(21, 30, 0)
    )

    {
    timp = Close[0];
    DrawLine("wv1" + CurrentBar, false, Time[0].AddMinutes(515), timp, Time[0].AddMinutes(1470), timp, Color.Green, DashStyle.Solid, 2);
    }

    I want the line drawed the next day, if i backtest it in the strategy analyzer it's corret most of days but in some it just plots a small dot in at the beginnig of the line and nothing else until the end of the day, any suggestoins?

    Thanks,

    Alex

    #2
    alext,

    Thank you for your post.

    I'm not sure I am seeing the same results as you are experiencing - would you be able to attach a screen shot to your next post with a chart with issues?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Sure, please note the small dot at the beginning of the day where the line isnt plotted.

      Alex
      Attached Files

      Comment


        #4
        alext,

        Thanks for the screen shots.

        The dots you are seeing are due to the session breaks in the session template where there is no data (I.e., over the weekend or a holiday).

        To avoid this, you may want to use if Bars.FirstBarOfSession rather than a specific time:

        MatthewNinjaTrader Product Management

        Comment


          #5
          Thank you Matthew, i dindt thinked about it.
          Like this seems to work fine:

          if (
          Bars.FirstBarOfSession
          )

          {
          DrawLine("wv1" + CurrentBar, true, Time[0], timp, Time[0].AddMinutes(1395), timp, Color.Green, DashStyle.Solid, 2);
          }

          Regards,

          Alex

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          94 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          49 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          31 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          71 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X