• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 yrch1985, 11-03-2019, 11:49 AM
    8 responses
    92 views
    0 likes
    Last Post aligator  
    Started by Dr3am, Today, 05:10 PM
    0 responses
    2 views
    0 likes
    Last Post Dr3am
    by Dr3am
     
    Started by imalil, Today, 04:28 PM
    0 responses
    3 views
    0 likes
    Last Post imalil
    by imalil
     
    Started by bboyle1234, Today, 03:47 PM
    0 responses
    1 view
    0 likes
    Last Post bboyle1234  
    Started by caveat_lector, Today, 03:46 PM
    0 responses
    7 views
    0 likes
    Last Post caveat_lector  
    Working...
    X