Input ?  [SOLVED]

Questions about MultiCharts and user contributed studies.
maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Input ?

Postby maxmax68 » 24 Nov 2012

Hi,
I'm a new user of Multichart and Powerlanguage.
Before I used an other software in javascript, so I'm trying to get my bearings.
About Input, I saw in some code snipets that it's possible to insert an input declaration in more points of the code. So, it's not important to use input declarations at the start of the code. It is correct ?
In javascript it was possible to list a number of options for every input item to choose from during data entry. It seemed easy, and that reduced the possibility of entering the data incorrectly.
Is it possible to specify the OPTIONS of input in PowerLanguage too?
I could not find information about that.
Best regards
Massimo

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Input ?  [SOLVED]

Postby TJ » 24 Nov 2012

Hi,
I'm a new user of Multichart and Powerlanguage.
Before I used an other software in javascript, so I'm trying to get my bearings.
About Input, I saw in some code snipets that it's possible to insert an input declaration in more points of the code. So, it's not important to use input declarations at the start of the code. It is correct ?
That is correct. You can declare your INPUT or VARIABLES anywhere in the code.
However you must declare the input or variables before they are used in the code.
In javascript it was possible to list a number of options for every input item to choose from during data entry. It seemed easy, and that reduced the possibility of entering the data incorrectly.
Is it possible to specify the OPTIONS of input in PowerLanguage too?
I could not find information about that.
Best regards
Massimo
With EasyLanguage, you implicitly declare the type in the INPUT or VAR declaration.
eg.

Code: Select all

INPUT:
myrisk(200),
mytext("Good Morning");
myrisk is a numeric because you have entered a number in the brackets,
while mytext is a string because you have entered a text with quotation marks "" inside the brackets.

Once you have compiled the indicator and applied it to a chart, you can change the input value any time you like. But you cannot change the type. Eg. You cannot put a text in myrisk because it has already been implicitly declared as numeric. And you cannot put a number in mytext because the quotation marks "" has been used to implicitly declare it as string.

Hope the above helps.


Return to “MultiCharts”