• 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 Dolosumo, Today, 01:05 AM
    0 responses
    1 view
    0 likes
    Last Post Dolosumo  
    Started by StevenNelson, Yesterday, 07:31 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChrisSch  
    Started by dtl-saw, Yesterday, 09:37 PM
    0 responses
    2 views
    0 likes
    Last Post dtl-saw
    by dtl-saw
     
    Started by TazoTodua, Yesterday, 03:01 PM
    3 responses
    13 views
    0 likes
    Last Post TazoTodua  
    Started by Mykro, Yesterday, 02:16 PM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X