• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to enter vertical line in chart output for Strategy Analyzer

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

    How to enter vertical line in chart output for Strategy Analyzer

    I'm trying to add a vertical line everyday that is being analyzed at a specific time. I've yet to make anything display and assuming I'm handling the time input incorrectly?

    Code:
    Draw.VerticalLine(this, "tag1", 64500, Brushes.Green)
    Thanks!

    #2
    Hello Dragon989,

    Thank you for your note.

    The following would draw a vertical line on the most recent current bar, 0.
    Draw.VerticalLine(this, "tag1",0, Brushes.Green);

    When you're passing 64500 its drawing a line 645000 bars Ago.

    If you wanted a line drawn at a specific time each day, say 9AM, you could use the following,

    if (Times[0][0].TimeOfDay == new TimeSpan(08,00, 0))
    Draw.VerticalLine(this, "tag1"+CurrentBar, 0, Brushes.Green);

    Notice I amend "Tag1" with the current bar, so the same line is not redrawn on each call but a new line is created.

    See draw.vertical line section of our HG:
    https://ninjatrader.com/support/help..._reference.htm

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello, for some reason with my ninja trader 8 code, no matter what Draw.VerticleLine or Draw.Line is called, it only draws a single verticle line on the last bar of the chart. It doesn't draw any other lines. So if there is a condition met then draw a verticle line. It draws one time even when the condition is met. Always on the very last bar on the chart.

      Draw.Line("My vertical line2" + CurrentBar, 0, Color.Cyan, DashStyle.Dash, 3);

      Draw.Line(this, "tag1", false, 0, 1000, 0, 1001, Brushes.LimeGreen, DashStyleHelper.Dot, 2);

      if (Times[0][0].TimeOfDay == new TimeSpan(08,00, 0))
      Draw.VerticalLine(this, "tag1"+CurrentBar, 0, Brushes.Green);

      Draw.VerticalLine(this, "someOtherfib", k, Brushes.Blue);

      Draw.VerticalLine(this, "someOtherfib", CurrentBar, Brushes.Blue);

      Any thoughts as to why this would happen.
      My only idea is that it may be related to:

      if (BarsInProgress != 0)
      return;
      Last edited by krimkrim; 03-27-2020, 09:05 PM.

      Comment


        #4
        Looks like you may be using the name "tag1" for each line, so you are only getting one line. Change the name to something like ("tag" + CurrentBar) to get unique line names.

        Comment


          #5
          Yes, thank you Zigfried! That fixed it.
          I used: Draw.VerticalLine(this, "tag1"+CurrentBar, 0, Brushes.Brown); //works excellent on NT8

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by aaadetos, Today, 09:59 AM
          1 response
          13 views
          0 likes
          Last Post aaadetos  
          Started by NinjaCustomer, Today, 09:32 AM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by aworldnervelink, Today, 06:43 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by Emma1, Today, 08:48 AM
          2 responses
          14 views
          0 likes
          Last Post Emma1
          by Emma1
           
          Started by pennywise, Yesterday, 05:49 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X