• 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 Dan_D_Trader, Today, 03:49 PM
    0 responses
    4 views
    0 likes
    Last Post Dan_D_Trader  
    Started by JohnAymin, Today, 02:38 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Tyler  
    Started by Rmos22, Today, 02:20 PM
    2 responses
    22 views
    0 likes
    Last Post Rmos22
    by Rmos22
     
    Started by sawtooth500, Today, 12:59 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Spencer  
    Started by Steve L, Yesterday, 09:36 PM
    1 response
    22 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X