Code an indicator where you can specify Data series  [SOLVED]

Questions about MultiCharts and user contributed studies.
brianhclo
Posts: 31
Joined: 31 Mar 2014
Has thanked: 8 times

Code an indicator where you can specify Data series

Postby brianhclo » 10 Nov 2014

I have a multi data charts, I would like to code an indicator whereby I could apply it to either Data1, Data2 etc...

Say normally I would plot
"plot1( SMA of Data2, "SMA");"

at the same time I may plot for Data3, 4 etc...

Do you know how I can have the Data number as an input?

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Code an indicator where you can specify Data series

Postby furytrader » 10 Nov 2014

One idea would be to have an input in your indicator to specify the data series and then use a series of if/then statements to assign a value to be plotted - in other words, something like:

Code: Select all

input: series(1);
vars: plotData(0);

if series = 1 then plotData = close of data1;
if series = 2 then plotData = close of data2;
if series = 3 then plotData = close of data3;

plot1(plotData);

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

Re: Code an indicator where you can specify Data series  [SOLVED]

Postby TJ » 10 Nov 2014

I have a multi data charts, I would like to code an indicator whereby I could apply it to either Data1, Data2 etc...
Say normally I would plot
"plot1( SMA of Data2, "SMA");"
at the same time I may plot for Data3, 4 etc...
Do you know how I can have the Data number as an input?
Data(2) is the same as Data2.


Return to “MultiCharts”