from this post it's not really clear what the problem is. From the MC post it appears you are having problems with how to create and name the list. This is something you have to do before you can work with it.
From the code piece you posted it appears that you want to read every line into its own list and store all those lists within a collection of lists.
I could better help you if I you could elaborate what exactly you want to achieve in the end. Meaning in what structure you need the strings later. Maybe what you are trying to do could be accomplished easier.
If you are sure you are on the right track a synopsis of what to do would be something like this:
1. Create a new (or shared) collection of lists.
2. Create a new list and read the first line of your file into this list.
3. Store the list within your collection. This should be done by a key you can easily re-access.
4. Create a new list and read the second line into this list.
5. Store this list within your collection.
Of course 2. to 5. should be done within a loop.
After that you can loop up each list by its key from the collection, call it and read the individual list values.
Again I am not sure that you need something like this and for understanding EL Collections I would strongly advise to start with something simple. Collections of Lists and Maps are more complex, but easily to manage once you have a solid ELC understanding.
To be honest.... I don't understand too much about ElCollection... I just don't get it.
File creation: Explanation of what I have already done,
A file is created. This file is created by capturing info on trend line that are draw on a chart. The goal is to reproduce these trend line to the same instrument but wit a lower scale. I draw trend line that represent bid support / resistance or supply / demand level. I draw them on a 4H and daily charts. Actually, I redraw them manually, I want it to be done by the code
File creation:
Each time a new Trend line is read, MC capture, The price, the date/time / color / size / style
Mc create a CSV string whit these data
Each string is terminated with the "NewLine" command
String are then entered in the file using the FileAppend command
At the end, I got a Text file named under the instrument that was used to capture trend line. Each Text file is specific to an instrument.
Explanation of what I want to achieve
I want to connect (create an ID) and open the text file
I need to read and put in variable named "TL_String" the first string ( inscription) of the text file
This TL_String will be process... (This work is done) and trend line is draw on a chart
Loop until all the string has been read in the file
To do these steps, I think that I need ElCollection
I need to learn
- how to "connect" create an ID (the path\name is under a variable name "FileName"
- How to read one string at the time and loop until all string has been read
- How to close the file if needed.
Hope it better explain what I want to achieve
Martin:
N.B.
Once finished, I will publish the code to reproduce the trend line over different chart using different scale.
While working on this , I created a tool that enable me to execute a function using a click of the mouse. Click on the upper corner, capture all trend line A click on the lower corner, will execute the function to reproduce the trend line. This enable me to control some function on MC using mouse click.. It could easily be modify the to enable me to have more clickable region that may act like command button. This section has been add to an indicator that I use on all charts
Since this only takes a few minutes I completed an example EasyLanguage indicator before I broke for lunch. You can expand on it to provide user defined colors and styles as well as any other operation applicable to a TrendLine.
File format would be as follows. startDate, startTime,startPrice,endDate,endTime,endPrice
Just to say that I finally succeed to use ElCollection. I got a better understanding of it now.
1- The initial goal was to capture from a a chart the present trend line. Store the characteristics of them in a file
2- Redraw the trend lines on another workspace using the stored data.
While creating the tool, I created a switch button concept using mouse click event
A click on the upper corner will capture trend line
A click on the lower corner will redraw using a file of the same instrument
To prevent fatal error using Elcollection, some verification has been done
First thing first: Check if the file do exist using : Value1 = ELC.PathExists(FilePath);
Always make sure that there is at least one inscription in the file. To do so, at the creation if no trend line present, I write "EOF" in the file. If "EOF" is detected as the first string value then don't try to read further and exit.
Count the the number of line in the file using: Count = ListS.Count(TL_String_ID) ;
Make sure that we don't try to read a line above the count number
On each event: a voice message is heard
Trend line are captured
Trend line are draw
No file Exist
No Trend line to draw
etc.
A Special thanks to ABC. FuryTrader, JohnB
Happy Xmas
All the best for the New Year to come
Martin
The following user says Thank You to arjfca for this post:
Were you wanting to do this in TradeStation or in MultiCharts ? If in MultiCharts then why post the query within the TradeStation programming forum ? I am new here so might be confused as to how the structure of questioning and forum structure goes.
I am well familiar with ELCollections. I actually have the source code for it given to me by the creator of the DLL many years ago. As you may know the creator of the ELC is now on the programming team at TradeStation and the ELC is an integral part of the TradeStation platform.
Regardless, glad to hear you have a solution because in the end that is all that matters.
The following user says Thank You to StratOpt for this post: