Change the display name on the chart

All posts which do not fit into any other sections of the forum.

Moderator: admin

Change the display name on the chart

Postby Loggy48 » Mon Nov 06, 2017 11:55 am

It is possible to set the display name shown on TS2/MarketScope to include current values of variables so the display may read:

MyStrategy: EURUSD m1 P1=1.0;P2=3.4

etc. by instance:name("MyStrategy: EURUSD m1 P1=1.0;P2=3.4") in the code.

If I change the value, for example, of P1 to 2.0 using the Change Strategy facility, this would immediately be shown in MarketScope and theIndicator/Strategy column of the events log.

If I change the value programmatically rather than by input, even though I reconstruct and call instance:name("MyStrategy: EURUSD m1 P1=2.0;P2=3.4") again, it is not changed in either, although host:trace can write it into the log so I will know that the updated value is actually used.

Is there a way to re-initialise this?
Loggy48
 
Posts: 89
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK

Re: Change the display name on the chart

Postby PetroIV » Tue Nov 14, 2017 5:03 am

Hello,
You can use the instance:name("new name") only on "Prepare" function for changing strategy name. if you use instance:name("new name") in other functions the name of strategy does not apply.
PetroIV
 
Posts: 24
Joined: Tue Aug 15, 2017 9:45 am

Re: Change the display name on the chart

Postby Loggy48 » Tue Nov 14, 2017 7:25 am

Thanks Petro

So Prepare is called not only at start up but whenever I change a parameter. A clue I think... :)
Loggy48
 
Posts: 89
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK



Return to General Discussions

Who is online

Users browsing this forum: No registered users and 8 guests