Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw a vertical line on the beginning of every week

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

    Draw a vertical line on the beginning of every week

    Is it possible to code in a vertical line drawn @ market open every week (not daily), ie. at 9:30 ET US every Monday?
    Possibly edit the existing Vertical Line indicator?

    #2
    Hello sastrades,

    Thank you for the message.

    Unfortunately, there is no default way within the NinjaTrader Platform to have it draw a line at the same time every day


    However, I was able to find this indicator within the publicly available NinjaTrader Ecosystem website that might add the functionality you are looking for:
    Here is a short video demonstration of the import process - How to Install a 3rd Party Indicator or App

    Here is a basic guideline on how to import NinjaScript add-ons in NinjaTrader:
    1. Download the NinjaScripts to your desktop, and keep them in the compressed .zip file.
    2. From the Control Center window, click Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc., and ask if you want to replace them, Always select 'No'.
    • The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    If you have any further questions about setting up or using the 3rd party add-on, you would have to reach back out to the developer for further help and information.
    Please let us know if we may provide any further assistance.​

    Comment


      #3
      here is a sample code that you can try:

      Code:
      #region Using declarations
      using System;
      using NinjaTrader.Gui.Tools;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.NinjaScript.Strategies;
      using NinjaTrader.Data;
      using NinjaTrader.NinjaScript.DrawingTools;
      #endregion
      
      namespace NinjaTrader.NinjaScript.Indicators
      {
          public class WeeklyOpenLine : Indicator
          {
              protected override void OnBarUpdate()
              {
                  // only run on historical data or new bars
                  if (Bars.IsFirstBarOfSession)
                  {
                      DateTime sessionOpen = Times[0];
      
                      // check if today is monday and time is 9:30 am et
                      if (sessionOpen.DayOfWeek == DayOfWeek.Monday && sessionOpen.TimeOfDay == new TimeSpan(9, 30, 0))
                      {
                          Draw.VerticalLine(this, "weekOpen" + sessionOpen.ToString("yyyyMMdd"), 0, Brushes.Blue, DashStyleHelper.Solid, 2);
                      }
                  }
              }
      
              public override string DisplayName => "Weekly Market Open Line";
          }
      }​[B][/B]

      Comment


        #4
        Thank you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        60 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        39 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        21 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        23 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        51 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X