plot legend from (implicit) string variable not possible

Questions about MultiCharts and user contributed studies.
ts2mc
Posts: 122
Joined: 12 Jan 2009
Been thanked: 1 time

plot legend from (implicit) string variable not possible

Postby ts2mc » 22 Jan 2009

Hello experts,
please put a look at this indicator code:


Variables: Legend("");
Plot1(123,Legend);


causes compiler error
Wrong plot name or missed ')'


where
Variables: Legend("");
Plot1(123,"Legend");

causes no error.
it seems, that the compiler does not treat var. Legend as string and/or
can't cast to constant string.

anyone know, how to pass string variable values for plot legend anyway ?

User avatar
TJ
Posts: 7090
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 986 times
Been thanked: 2025 times

Postby TJ » 22 Jan 2009

plot is not for string.
you have to use text_new().


you can get the manual, with examples here:
http://www.tssupport.com/support/tutorials/
see middle of right column

User avatar
TJ
Posts: 7090
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 986 times
Been thanked: 2025 times

Postby TJ » 23 Jan 2009

is it a new feature? that you can plot text in the new TS?

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Re: plot legend from (implicit) string variable not possible

Postby Marina Pashkova » 27 Jan 2009

Hello experts,
please put a look at this indicator code:


Variables: Legend("");
Plot1(123,Legend);


causes compiler error
Wrong plot name or missed ')'


where
Variables: Legend("");
Plot1(123,"Legend");

causes no error.
it seems, that the compiler does not treat var. Legend as string and/or
can't cast to constant string.

anyone know, how to pass string variable values for plot legend anyway ?


Hi ts2mc,

A variable cannot be used as a plot name. The only way you can use names for plots is as follows:

Code: Select all

plot1(0, "zero plot");
plot2(1, "plot2");


Return to “MultiCharts”