Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 stafe, 04-15-2024, 08:34 PM
    9 responses
    42 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by frslvr, 04-11-2024, 07:26 AM
    7 responses
    111 views
    1 like
    Last Post caryc123  
    Started by rocketman7, Today, 09:41 AM
    3 responses
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by traderqz, Today, 09:44 AM
    2 responses
    5 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by rocketman7, Today, 02:12 AM
    7 responses
    31 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X