Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Displaying the Day of the Week (DOW)

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

    Displaying the Day of the Week (DOW)

    Hi,

    I'm using intraday charts and I would like to be able to display the Day Of the Week on the chart i.e. bottom left beside the session start vertical line.
    This way, when I scroll back through the charts, it displays the actual day of the week beside each new session.
    I have tried the following and it sort of works. i.e. if I leave out the IF statement and just use the switch, I can get it to display on the far left (not session start). With the if statement I get nothing.

    if (Bars.FirstBarOfSession)
    {
    switch (Time[0].DayOfWeek)
    //switch (Bars.GetTime.dayofweek)
    {
    case DayOfWeek.Monday : DOW = "Monday" ; break ;
    case DayOfWeek.Tuesday : DOW = "Tuesday" ; break ;
    case DayOfWeek.Wednesday : DOW = "Wednesday" ; break ;
    case DayOfWeek.Thursday : DOW = "Thursday" ; break ;
    case DayOfWeek.Friday : DOW = "Friday" ; break ;
    case DayOfWeek.Saturday : DOW = "Saturday" ; break ;
    case DayOfWeek.Sunday : DOW = "Sunday" ; break ;
    }
    graphics.DrawString("DOW = " + DOW, ChartControl.Font, textBrush, bounds.X , bounds.Y + bounds.Height - (50+textHeight), stringFormat);
    }



    Any ideas?

    Thanks,
    Neil.

    #2
    Neil, did you try adding prints to check if the FirstBarOfSession is triggering as you would expect in your script? It would just evaluate to 'true' if the bar detected is starting a new session, it would not effect the relative placement of your custom graphcis.

    Comment


      #3
      Hi,
      I have the below code in the OnBarUpdate. In the Output box, I get the days of the week scrolling through but on my chart I always get Tuesday, which happens to be the last traded day.

      Also, how do I tie this to the session open time? i.e. print below the first bar of each new session?

      string DOW = "";
      if (Bars.FirstBarOfSession)
      {
      switch (Time[0].DayOfWeek)
      //switch (Bars.GetTime.dayofweek)
      {
      case DayOfWeek.Monday : DOW = "Monday" ; break ;
      case DayOfWeek.Tuesday : DOW = "Tuesday" ; break ;
      case DayOfWeek.Wednesday : DOW = "Wednesday" ; break ;
      case DayOfWeek.Thursday : DOW = "Thursday" ; break ;
      case DayOfWeek.Friday : DOW = "Friday" ; break ;
      case DayOfWeek.Saturday : DOW = "Saturday" ; break ;
      case DayOfWeek.Sunday : DOW = "Sunday" ; break ;
      }
      DrawTextFixed("DOW", DOW, TextPosition.BottomLeft);
      Print("Printed "+DOW);
      }
      Last edited by NWT27; 11-09-2010, 03:38 PM.

      Comment


        #4
        Hello NWt27,

        You will likely want to use DrawText(), as DrawTextFixed() places one object in a static position on the chart. It will use the last bar to get its values.

        if (Bars.FirstBarOfSession)
        DrawText("DOW" + CurrentBar, Time[0].DayOfWeek.ToString(), 0, Low[0] - TickSize * 15, Color.Black);
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Perfect, Thanks.

          And so much simpler than mine

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          601 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          559 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          558 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X