Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Line thru tomorrow

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

    Draw Line thru tomorrow

    Hi All,

    How do I draw a line that starts today say at 9 pm and goes thru to tomorrow 8 am?

    My draw line statement is as follows:

    DrawLine(HighLine.ToString(), false, StartTime, HH, EndTime, HH, Color.Green, DashStyle.Solid, 2);

    Where StartTime & EndTime are:

    StartTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 21, 00, 0);
    EndTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 8, 00, 0);

    It works just fine when I want it to draw lines from say 8 am to 11 am. But from the night session thru the day session, it draws the line from 8 am of the current day to 9 pm of the current day as oppose to from 9 pm of current day to 8 am of the following day.

    All help is greatly appreciated.

    #2
    Hello GeoOrtiz,

    I believe the problem is that you are using the same day for start and end times. I believe changing this line

    Code:
    EndTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].[B]Day[/B], 8, 00, 0);
    to this

    Code:
    EndTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].[B]Day + 1[/B], 8, 00, 0);
    will allow you to see the problem straight away. I recommend comparing StartTime to EndTime, and adding 1 to EndTime if it is before StartTime.

    If you provide a complete code sample, I will be able to assist further.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you Jessica. The "+ 1" did the trick!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rocketman7, Today, 02:12 AM
      5 responses
      23 views
      0 likes
      Last Post rocketman7  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      7 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by samish18, 04-17-2024, 08:57 AM
      17 responses
      66 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by briansaul, Today, 05:31 AM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by PaulMohn, Today, 03:49 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X