Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

vertical line on the current bar

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

    vertical line on the current bar

    any one know of any indicator that will plot a vertical line on the current bar
    and sound an alert on the close of the bar and then plot on the next
    open bar

    #2
    Originally posted by aotegaoteg View Post
    any one know of any indicator that will plot a vertical line on the current bar
    and sound an alert on the close of the bar and then plot on the next
    open bar
    It is a simple indicator that you can create yourself.
    Start a new indicator with the following guiding ideas:

    In Initialize:
    CalculateOnBarClose = False;
    Overlay = True;
    In OnBarUpdate:
    if (FirstTickOfBar) {
    DrawVerticalLine("vertical", 0, Color.Red); // draw the vertical line
    PlaySound("Alert4.wav"); // sound an alert on the close of a bar
    }
    Please study the functions in depth at http://www.ninjatrader.com/support/h..._reference.htm

    Cheers,
    Pi
    Last edited by ninZa; 12-31-2014, 03:02 AM.
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    Comment


      #3
      How do i get the VerticalLine to show 1 bar before and not on the current active bar i have tried to modfyi the code see below, but the VerticalLine is always to the right
      and not 1 bar before

      DrawVerticalLine("vertical", +1, Color.Red); // draw the vertical line

      Comment


        #4
        Hi aotegaoteg,

        When does this line get drawn?

        Does this line draw when the bar closes?

        If the line draws when the bar closes and you want it to be on the most recently closed bar (the bar that just closed) use DrawVerticalLine("lineTag", 0, Color.Red);

        If you want to draw on the bar previous to the most recently closed bar use DrawVerticalLine("lineTag", 1, Color.Red);


        If you are drawing the line intra-bar then use DrawVerticalLine("lineTag", 1, Color.Red); to draw on the most recently closed bar and DrawVerticalLine("lineTag", 2, Color.Red); to draw on the bar previous to the most recently closed bar. Use DrawVerticalLine("lineTag", 0, Color.Red); to draw on the currently building bar.

        Let me know if this does not help.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          i tried your suggestions but the line doesn't appear on the chart, when using this line DrawVerticalLine("lineTag", 1, Color.Red);
          but it appears if i change the "1"to a "0"but this plots the line on the current bar what i want to archive is
          to draw a vertical line that plots 1 bars ago from the current active bar
          thanks for your help

          Comment


            #6
            Originally posted by aotegaoteg View Post
            i tried your suggestions but the line doesn't appear on the chart, when using this line DrawVerticalLine("lineTag", 1, Color.Red);
            but it appears if i change the "1"to a "0"but this plots the line on the current bar what i want to archive is
            to draw a vertical line that plots 1 bars ago from the current active bar
            thanks for your help
            Please add this statement at the very first line of OnBarUpdate:

            if (CurrentBar < 1) return;
            Cheers,
            Pi
            ninZa
            NinjaTrader Ecosystem Vendor - ninZa.co

            Comment


              #7
              thank you this has worked

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cre8able, Today, 01:16 PM
              2 responses
              9 views
              0 likes
              Last Post cre8able  
              Started by chbruno, 04-24-2024, 04:10 PM
              3 responses
              48 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by samish18, Today, 01:01 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by WHICKED, Today, 12:56 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by WHICKED, Today, 12:45 PM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X