• 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

Help with Ray Anchor Points

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

    Help with Ray Anchor Points

    Hi NT Support,

    I have the following code in a strategy I'm developing:


    Code:
    if(myLine == null && State != State.Historical) //Initial set of Ray
    {
             myLine = Draw.Ray(this, "MyLine", true, 10, High[10], 5, High[10], Brushes.Blue, DashStyleHelper.Solid, 2);
             myLine.IsLocked = false;
    }
    
    if(myLine != null && State != State.Historical) 
    {
            Print(DateTime.Now+" Last BarsAgo= "+myLine.EndAnchor.BarsAgo+" First BarsAgo= "+myLine.StartAnchor.BarsAgo);
    }


    Before I manually move the Ray on the chart, the following info is printed, which is correct:

    10/22/2019 4:32:51 PM Last BarsAgo= 5 First BarsAgo= 10


    But, after I manually move the Ray on the chart, I get the following output:

    10/22/2019 4:32:52 PM Last BarsAgo= -2147483648 First BarsAgo= 10



    I'm trying to ascertain why the BarsAgo value for the EndAnchor appears to get corrupted or be incorrect.

    #2
    Hello maltese,

    Thank you for the post.

    This is expected as the object is now a manually drawn after moving it. The BarsAgo property and also the DrawnOnBar only relate to script drawn objects, you instead would need to use SlotIndex after manually moving it.This is noted in the BarsAgo and DrawnOnBar documentation.

    Please note that SlotIndex is not exactly the same as your scripts BarsAgo. The SlotIndex is the nearest bar slot value where anchor is drawn on a chart.

    https://ninjatrader.com/support/help...8/?barsago.htm
    https://ninjatrader.com/support/helpGuides/nt8/?drawnonbar.htm.


    I look forward to being of further assistance.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello maltese,

      Thank you for the post.

      This is expected as the object is now a manually drawn after moving it. The BarsAgo property and also the DrawnOnBar only relate to script drawn objects, you instead would need to use SlotIndex after manually moving it.This is noted in the BarsAgo and DrawnOnBar documentation.

      Please note that SlotIndex is not exactly the same as your scripts BarsAgo. The SlotIndex is the nearest bar slot value where anchor is drawn on a chart.

      https://ninjatrader.com/support/help...8/?barsago.htm
      https://ninjatrader.com/support/helpGuides/nt8/?drawnonbar.htm.


      I look forward to being of further assistance.




      OK. Thanks. That helped.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jtrading82, 10-11-2019, 05:07 PM
      8 responses
      73 views
      1 like
      Last Post sledge
      by sledge
       
      Started by MARTIN MARTIN, Yesterday, 01:01 PM
      3 responses
      39 views
      0 likes
      Last Post MARTIN MARTIN  
      Started by NickyD, Today, 11:42 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by cupir2, Today, 11:25 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by 7robert, Today, 11:15 AM
      2 responses
      7 views
      0 likes
      Last Post 7robert
      by 7robert
       
      Working...
      X