Help with ListN Plotting

Questions about MultiCharts and user contributed studies.
olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Help with ListN Plotting

Postby olobay » 21 Aug 2021

Hi,

I have created a file that plots a horizontal line from price data in an Excel csv file. Everything works fine but I would like to know if there is a better way to code the plot portion of the code to just plot everything. Right now, if I have 10 rows of data in my Excel file, I would need 10 plot statements in my indicator, incrementing the ref number on every line. For example:

Plot1(Listn.Get(ListID, 1));
Plot2(Listn.Get(ListID, 2));
Plot3(Listn.Get(ListID, 3));
etc

Is there a simple one line method to just plot everything from my Excel file?

Thanks.

Code: Select all

Inputs: File_Directory("C:\Book1.csv"); var: listid(0); listid = Listn.New; value1 = Listn.Readfile(listid, File_Directory); Plot1(Listn.Get(ListID, 1));

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Help with ListN Plotting

Postby ABC » 23 Aug 2021

olobay,

you could loop through the contents of your list and use a switch statement to pass an entry to a respective plot number. However, you would still have to add X different plots where X is the number of rows you read into the list. It might look more elegant, but it will likely not be less code compared to what you are doing now.

Regards,

ABC
Hi,

I have created a file that plots a horizontal line from price data in an Excel csv file. Everything works fine but I would like to know if there is a better way to code the plot portion of the code to just plot everything. Right now, if I have 10 rows of data in my Excel file, I would need 10 plot statements in my indicator, incrementing the ref number on every line. For example:

Plot1(Listn.Get(ListID, 1));
Plot2(Listn.Get(ListID, 2));
Plot3(Listn.Get(ListID, 3));
etc

Is there a simple one line method to just plot everything from my Excel file?

Thanks.

Code: Select all

Inputs: File_Directory("C:\Book1.csv"); var: listid(0); listid = Listn.New; value1 = Listn.Readfile(listid, File_Directory); Plot1(Listn.Get(ListID, 1));


Return to “MultiCharts”