Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartObject "AttachTo" Property

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

    ChartObject "AttachTo" Property

    Hi,
    is there a property for a ChartObject (e.g. horizontal line) that contains the Instrument it is attached to?
    If you
    1) draw a horizontal line
    2) change the Instrument of the chart
    3) peruse the ChartObjects collection
    the horizontal line will still be found in that collection but it no longer pertains to the current Instrument.
    (Note this is not the case with Global objects - they seem to disappear from the collection when the Instrument is changed)

    Thanks,
    saltminer

    #2
    Hi saltminer, thanks for posting.

    The GetAttachedToChartBars() can get the instrument the line is attached to. Test code:

    HorizontalLine HZ = Draw.HorizontalLine(this, "line", High[0], Brushes.Red);
    Print(HZ.GetAttachedToChartBars().Bars.Instrument) ;

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    94 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    140 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    74 views
    0 likes
    Last Post PaulMohn  
    Working...
    X