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

Draw.Ray StartAnchor.BarsAgo Does not update

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

    Draw.Ray StartAnchor.BarsAgo Does not update

    Guys, in NT8, inside a Ray object, the StartAnchor.BarsAgo command returns a static value equal to the bars back of the start anchor point at the time the Ray was initially drawn. That is, the value does not update as new bars are added to the chart. For example, if when the Ray was first drawn its starting anchor was 5 bars ago, then the StartAnchor.BarsAgo command will return "5" on every bar thereafter. In NT7, the equivalent command updates with every new bar added to the chart, so the value would be "5" plus the number of bars added to the chart since the Ray was drawn. Is this intentional? If so, it adds a layer of complexity when converting NT7 code into NT8. I haven't checked other draw objects (e.g. Draw.Line), but it may be true for them as well.

    Thank you for your help...

    Light

    #2
    Hello Light,

    Yes, this is expected.

    From the help guide:

    "<ChartAnchor>.BarsAgo - An int representing the "barsAgo" value that was passed to the Draw method"


    Instead, you may want <ChartAnchor>.DrawnOnBar or .Time.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks ChelseaB. The problem is identifying the anchor points of a previously-drawn line or ray. In NT7, this was simple. In terms of their number of bars back from the current bar, they are MyLine.StartBarsAgo and MyLine.EndBarsAgo. That's all... But in NT8, as I understand the commands, this same information, i.e. the number of bars back to the starting and ending points of a line from the current bar, would require the following sums:

      (CurrentBar-MyLine.StartAnchor.DrawnOnBar)+MyLine.StartAnchor. BarsAgo

      and

      (CurrentBar-MyLine.EndAnchor.DrawnOnBar)+MyLine.EndAnchor.Bars Ago

      The sum is required because in NT8 "StartAnchor.BarsAgo" and "EndAnchor.BarsAgo" do not update as new bars are added to the chart. (Also, StartAnchor.DrawnOnBar and EndAnchor.DrawnOnBar are not the start-anchor and end-anchor points, but the simply the CurrentBar value when the line with those anchor points was drawn.) I can certainly adapt my code to match, but it's cumbersome translating indicators from NT7 into NT8 that make extensive use of anchor points. It is also confusing since the BarsAgo names are so similar and yet the behavior so different from NT7. Just thought I should point out my concerns in case others have the same experience...

      Thanks again for your help...

      Light
      Last edited by Light; 07-17-2017, 04:52 PM. Reason: Added comments about DrawnOnBar

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,602 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      12 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X