• 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

Plot labels

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

    Plot labels

    Hi guys, I'm having some problems changing a plot label as follows:

    Variables

    private string ibh1 = "";


    protected override void Initialize()
    {

    Add(new Plot(new Pen(Color.Gray,1), PlotStyle.Line,ibh1));

    }

    What I'm trying to do is dynamically change that plot label to something in onbarupdate based on a condition.

    Eg: if

    if (Instrument.MasterInstrument.Name == "TF"){ibh1="1-95%";}

    The issue is the "1-95%" doesn't show up on the chart. Any ideas on this one?

    Thanks in advance
    DJ

    #2
    You can change the name of a plot in OnStartUp(). For example, if you want to change the label of the first plot, then you could use the code

    Code:
    protected override void OnStartUp()
    {
         if (Instrument.MasterInstrument.Name == "TF")
               Plots[0].Name = "1-95%";
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ntbone, Yesterday, 09:54 PM
    0 responses
    7 views
    0 likes
    Last Post ntbone
    by ntbone
     
    Started by rwilliam, Yesterday, 03:14 PM
    0 responses
    8 views
    0 likes
    Last Post rwilliam  
    Started by rwilliam, Yesterday, 03:10 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rontronimous, Yesterday, 03:04 PM
    2 responses
    12 views
    0 likes
    Last Post rontronimous  
    Started by zacharydw00, Yesterday, 03:14 PM
    0 responses
    9 views
    0 likes
    Last Post zacharydw00  
    Working...
    X