Hi,
I’m looking for help regarding how to write code to open a file in the format below and parsing the text then writing the data to another file:
File to read from: C:\Strategy\marker.txt
Text in file: 10:58:15 1185.00 @ESZ11 SELL SIGNAL
Can anybody provide some assistance to how I can read from the file above?
I have found some information in the following thread http://www.multicharts.com/discussion/v ... f=5&t=8880 but I’m not sure if I need to configure the ADE and EL collections in MC 7 or if these are now included.
Thanks,
Bobby
Help with reading from a file
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Help with reading from a file
Hello Bobby.
You need to write a custom Dll to work with files.
We can write it for you as a custom paid project.
Please contact us directly if you are interested in custom programming.
You need to write a custom Dll to work with files.
We can write it for you as a custom paid project.
Please contact us directly if you are interested in custom programming.
Re: Help with reading from a file
There is info on reading from files in this thread. I created a modified document from damageboy's ELcollections info showing how to read from files with a few extra examples.
viewtopic.php?=&p=8189
to split out your text the EL string functions can do it if they are of consistent format.
None maybe as fast as a dll but easier to put together. It would be hard to sell MC if all buyers needed to know C programming. I have been programming 30 years and I do not know C.
There is a good example of an ELcollections read in the zip file in here.
viewtopic.php?f=1&t=6919&p=29724&hilit=listc#p29724
viewtopic.php?f=1&t=6901&hilit=listc
viewtopic.php?=&p=8189
to split out your text the EL string functions can do it if they are of consistent format.
None maybe as fast as a dll but easier to put together. It would be hard to sell MC if all buyers needed to know C programming. I have been programming 30 years and I do not know C.
There is a good example of an ELcollections read in the zip file in here.
viewtopic.php?f=1&t=6919&p=29724&hilit=listc#p29724
viewtopic.php?f=1&t=6901&hilit=listc
Re: Help with reading from a file
Thanks for your help bowlesj3. I can now read from the file.
Currently I delete the file after I have read from it and then when my code tries to read it again there are errors because the file does not exist. What I'm trying to do is:
1) check if the file exists
2) if the file does exist then read the content (done)
3) delete the file (done)
Is there a way to check the file exists before reading from it and if it does then execute some code?
Currently I delete the file after I have read from it and then when my code tries to read it again there are errors because the file does not exist. What I'm trying to do is:
1) check if the file exists
2) if the file does exist then read the content (done)
3) delete the file (done)
Is there a way to check the file exists before reading from it and if it does then execute some code?
Re: Help with reading from a file
Yes, but I have not used it. In the EL collections there is a command for it. I extracted the documentation below. I guess you have the EL collections set up now so it should be able to just execute it. I find the EL collections documentation is very useful to reread every 6+ months. It is surprising how new (almost exciting) it seems if you wait 6 to 12 months before you sit down over a relaxing coffee and just plow through it all again.
Value1 = ELC.PathExists(FilePath);
Returns true if the specified file path exists. FilePath can be either a file or a directory. For example, the following code prints a message if a symbol file exists:
if ELC.PathExists(“C:\Temp\Symbols.txt”) then Print(“Found symbol file”);
The following code prints a message if the specified directory exists:
if ELC.PathExists(“C:\Temp\Data”) then Print(“Data directory found”);
Re: Help with reading from a file
I find this daily routine handy at times.
I found the above command quickly because I use a reminder system in my calendar. I put things I want to remember in my calendar to popup some time in the future (all sorts of things). I see a few of them once a day and I will bump them ahead to where I might want a reminder again or just put them out far enough that I do not get too overloaded with reminders. It is a daily routine. So I created a popup of useful commands for EL coding and I added a few things from a 2nd or 3rd read of the EL collections. I can search these popup reminders and sure enough using "exists" I found this popup and went in and found the command. In other words I thought I might use it in the future and I wanted to be aware of it or I wanted a place where I could search for it. If I did not do this I probably would not have been able to answer the question so fast. Sometimes I will read though the list of useful commands looking for something and I get a review of all these useful commands. So far I think I have gone back to use 25% of them.
I found the above command quickly because I use a reminder system in my calendar. I put things I want to remember in my calendar to popup some time in the future (all sorts of things). I see a few of them once a day and I will bump them ahead to where I might want a reminder again or just put them out far enough that I do not get too overloaded with reminders. It is a daily routine. So I created a popup of useful commands for EL coding and I added a few things from a 2nd or 3rd read of the EL collections. I can search these popup reminders and sure enough using "exists" I found this popup and went in and found the command. In other words I thought I might use it in the future and I wanted to be aware of it or I wanted a place where I could search for it. If I did not do this I probably would not have been able to answer the question so fast. Sometimes I will read though the list of useful commands looking for something and I get a review of all these useful commands. So far I think I have gone back to use 25% of them.