Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I change the title of the strategy window within the strategy code?

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

    Can I change the title of the strategy window within the strategy code?

    Right now each chart has the title: Instrument Period Date.

    Is it possible to access that property from within the strategy code and change it? let's say adding the account name of running strategy?

    Thanks.

    Edit: I don't mind using reflection if that's the only way.
    Last edited by benharper; 05-14-2015, 11:20 AM.

    #2
    Hello benharper,

    Thank you for your post.

    I am not certain how to remove the date, but using unsupported code in OnStartUp() we can change the label of the chart. Add the following after the Initialize() method and this will change the label to the account name used for the strategy (this code will only work in a strategy due to calling Account.Name):
    Code:
    		protected override void OnStartUp()
    		{
    			ChartControl.BarsArray[0].BarsData.Label = @"""" + Account.Name + @"""";
    		}

    Comment


      #3
      Excellent! Exactly what I was looking for. And I don't mind the date really, I just want to add the strategy name and the account. So this is perfect.

      Code:
      string label = Instrument.FullName + " " + Bars.Period.Value + ""+ Bars.Period.Id.ToString().Substring(0,1) + " " + this.Name + " " + Account.Name;
                  ChartControl.BarsArray[0].BarsData.Label = @"""" + label + @"""";

      Comment


        #4
        One more clarification: shouldn't I call Base.OnStartUp()? Can I assume the base function is empty?

        Comment


          #5
          Hello benharper,

          You can call
          protected override void OnStartUp()
          in the Strategy class. No need to call Strategy or Indicator Base.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X