Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting data and values from an object created outside the script ?

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

    Getting data and values from an object created outside the script ?

    Hello !

    Is it possible, to get the value and data, for example of a ruler or a line, in a ninjascript (a indicator or a strategy), but that the object, has not been created by the ninjascript.
    Example : I have a strategy on a chart, its enable, i draw a ruler on the chart, with no rapport of the strategy, and i would like that the strategy could know that the object type "ruler" has been drawn on the chart, take the value that the ruler has created (time, bar, y value). since the tag of 2 ruler can be different, the strategy will take only the value of a ruler that actually exist, and if there is multiple she will only take the first ruler.

    For the goal, to take the amount of bar of the ruler, and put in a double.
    And, its about being enable to get the values of a object not drawn by the script that i have problem with, and where i don't find a lot of documentation.

    So, is this possible to do ?

    Thanks !

    #2
    Hello Robinson94,

    It is possible to loop through the chart objects and view a manually drawn objects properties.

    Below is a link to the help guide on the DrawObjects collection.


    If exporting, a consideration is to cast objects from the collection to the dynamic type when looping through this collection.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the indication !
      I have a new question, with looping, i'm now enable to get the time between the two points of an object (start and end).
      So i ended up with two different time, and now i would like, to be enable to calculate the amount of bars between those 2 times. But i don't find how...

      I have think about getting the bar number for the 2 time, then making amountofbars1 - amountofbars2 to get the amount of bar inside.
      Or simply asking the script to look how much bar is there inside those two moments.

      But i cannot figure out how to get bars data, and how to do those operation, or any other that could to the job, could you help ?

      Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      368 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      571 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X