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