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 traderqz, Today, 12:06 AM
      2 responses
      3 views
      0 likes
      Last Post traderqz  
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DavidHP, Today, 07:56 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by kujista, Today, 06:23 AM
      3 responses
      11 views
      0 likes
      Last Post kujista
      by kujista
       
      Working...
      X