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

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 stafe, 04-15-2024, 08:34 PM
    7 responses
    31 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by adeelshahzad, Today, 03:54 AM
    4 responses
    29 views
    0 likes
    Last Post adeelshahzad  
    Started by merzo, 06-25-2023, 02:19 AM
    10 responses
    823 views
    1 like
    Last Post NinjaTrader_ChristopherJ  
    Started by frankthearm, Today, 09:08 AM
    5 responses
    17 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    43 views
    0 likes
    Last Post jeronymite  
    Working...
    X