Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there a way to discover which chart a global object was originally attached to?

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

    Is there a way to discover which chart a global object was originally attached to?

    I use the Fibonacci Retracement tool, and I usually just use them locally, that is to say, the fib is placed on one chart only.

    Sometimes I change them to be global though, so it shows on all charts.

    My question is, if I place a fib locally on a chart, and then switch it to global after that, is there a way to look into the XML code or somewhere else, to find out which chart the fib was originally attached to , prior to switching it to be global?

    #2
    Hello ra1den,


    Thank you for your forum post.


    I am not familiar with a way to locate which chart the drawing object would have been originally drawn on.


    You can check the .xml file for the workspace that the drawing object was applied to:
    • C:\Users\<USERNAME>\Documents\NinjaTrader 7\workspaces
    • Locate the workspace name > Right mouse click > Edit
    • You will be able to see the details in the .xml workspace file for the workspace.
    Ryan L.NinjaTrader Customer Service

    Comment


      #3
      Match instrument name to a drawing object without opening up XML file

      To go one step further:

      Is there a way to programmatically determine which instrument a drawing object associated with while using an indicator? Instead of presumably doing a file open of the workspace XML file as suggested below.

      I see the <VisibleOnInstrument> tag in the XML alluded to earlier in this thread, but is there a way to do this with a DrawingObject or ChartObject in C#?

      That is, instead of using a brute force method doing file open and parsing the XML strings to match the instrument name in the XML file.

      I have been looking into this to upgrade the LabelHorzLinesAlerts public indicator so that it only labels lines drawn on the current instrument, but have not found an obvious answer.

      I've gone through the DrawObjects help page here:


      Which I was directed to here:


      It seems as though the DrawObject class is the same global implementation as the ChartObject class and the issues in the later URL planned for enhancement in 2008 are still the same in 2014.

      Ninja Trader seems to faithfully save this information in the XML, but I haven't found an obvious class and method that performs something like:

      if (drawobject.VisibleOnInstrumentTag == instrumentName)

      Or maybe is there perhaps another object class that is local (not global) to the instrument data series currently loaded into a chart?

      Something like CurrentDataSetDrawObject instead of just DrawObject?

      ##############################################

      foreach (IDrawObject dobject in DrawObjects)
      {
      if (dobject.DrawType is IHorizontalLine)
      {
      // do some actions to draw the labels
      //Print (Instrument.FullName.ToString());
      //IHorizontalLine l1 = (dobject as IHorizontalLine);

      Comment


        #4
        Hi claybuddy,

        Are the drawing objects manual objects or drawn with the indicator?

        If they are drawn with the indicator, they will be attached to the indicator and not to a chart data series. (When the indicator is removed the objects are removed)

        If you are trying to find manually drawn objects, I do not believe the attached to can be pulled up.

        To find manually drawn objects you can loop through the DrawObject collection and find if the object is UserDrawn, but you will not be able to see the indicator or data series it is attached to.

        foreach(IDrawObject draw in DrawObjects)
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        6 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X