Page 1 of 1

Change the display name on the chart

PostPosted: Mon Nov 06, 2017 11:55 am
by Loggy48
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?

Re: Change the display name on the chart

PostPosted: Tue Nov 14, 2017 5:03 am
by PetroIV
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.

Re: Change the display name on the chart

PostPosted: Tue Nov 14, 2017 7:25 am
by Loggy48
Thanks Petro

So Prepare is called not only at start up but whenever I change a parameter. A clue I think... :)

Re: Change the display name on the chart

PostPosted: Sun Nov 19, 2017 4:22 pm
by Apprentice
Yes.