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?
Code an indicator where you can specify Data series [SOLVED]
- 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
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);
- 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]
Data(2) is the same as Data2.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?