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

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/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/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 mmckinnm, Today, 01:34 PM
      3 responses
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by f.saeidi, Today, 01:32 PM
      2 responses
      5 views
      0 likes
      Last Post f.saeidi  
      Started by alifarahani, 04-19-2024, 09:40 AM
      9 responses
      55 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Conceptzx, 10-11-2022, 06:38 AM
      3 responses
      60 views
      0 likes
      Last Post NinjaTrader_SeanH  
      Started by traderqz, Today, 12:06 AM
      9 responses
      16 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X