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

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 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
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Started by alifarahani, Today, 09:40 AM
      6 responses
      41 views
      0 likes
      Last Post alifarahani  
      Working...
      X