Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing objects tag

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

    Drawing objects tag

    Hello, to all

    I'm trying to change and keep tags of manually drawing objects.

    first I determine chart of object was drawn

    protectedoverridevoid OnStartUp()
    {
    tag = BarsPeriod.Value.ToString()+ BarsPeriod.BasePeriodType.ToString();

    }

    and than change the object tag

    protectedoverridevoid OnBarUpdate()
    {
    foreach (ChartObject co in ChartControl.ChartObjects)
    {
    if (co is ChartLine & co.UserDrawn == true)
    {
    if(co.Tag.Contains("Minute") == false)
    {
    string otag = co.Tag+tag;
    co.Tag = otag;
    }

    }
    }

    Everything works, and the script changes tags. But if I switch chart to another time period it changes tags again. But I have check for new change. It seems that the tags are not saved.

    My idea is to color global objects on other chart depends on color defined to chart on which it was first drawn automatically.

    Regards.

    #2
    Hello alex_bbfg,

    When the chart changes time frames, this causes the indicator to reload using the new time frames information.

    For any information that you would like to persist, the best option is to write this to a file. (Using a static class would take a lot of work and may not work anyways)

    I'd like to clarify what you are trying to do.
    You want to open a chart as a master chart and draw a few objects.
    These objects would then replicate to all other charts that are running the indicator depending on if the tag name set for the indicator and the tag name of the object that was drawn. Is this correct?

    If so, the master chart would write to file the global tag names as well as the x and y values, then in the other charts they would read from this file for a list of names. If the list contains the name set as a parameter in the client chart then it draws the object using the x and y coordinates saved in the file.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    130 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    74 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    117 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    111 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    89 views
    0 likes
    Last Post CarlTrading  
    Working...
    X