ElCollection: Want to understand - EasyLanguage Programming | futures io social day trading
futures io futures trading


ElCollection: Want to understand
Updated: Views / Replies:3,526 / 13
Created: by arjfca Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

ElCollection: Want to understand

  #1 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received

ElCollection: Want to understand

Hello

I did post a similar question on Multicharts forum, but no answerd yet.
MultiCharts: Trading Software for Automated Trading and Backtesting ? View topic - Elcollection: Going through CSV file// Want to understand...

I read many time the ElCollection manual, but no success yet.

My goal is to read string by string a file that contain a collection of strings

A string Look like
HTML Code:
5,132.226120,132.379180,41549.9083333333,41549.9868055556,2124031,1,0,False,False

Variable FileName contain the Path\Filename
Variable TL_String to contain an individual string read from the file

I need to get to this kind of code
 
Code
ID = Unidentified Function(filename)
for Index = 1 to ListC.Count(ID) begin
	TL_String = ListC.Get(ID, Index);
	// do something with TL_String
end;

Any help appreciated
Martin


HTML Code:
5,132.226120,132.379180,41549.9083333333,41549.9868055556,2124031,1,0,False,False
38,133.690000,133.690000,41578.5416666667,41579.2916666667,2124031,1,2,False,True
51,139.249120,139.249120,41614.0416666667,41615.0416666667,2124031,1,0,False,False
54,141.060430,141.066520,41616.7500000000,41618.0000000000,2124031,1,0,False,False
1,130.810000,572.277778,41487.0000000000,41487.0000000000,32768,1,0,False,False
2,130.085000,69.090278,41487.0000000000,41487.0000000000,32768,1,0,False,False
3,131.785000,572.277778,41490.7500000000,41490.7500000000,16711680,3,0,False,False
4,131.130000,69.090278,41490.7500000000,41490.7500000000,16711680,3,0,False,False
6,128.725000,572.277778,41497.7500000000,41497.7500000000,16711680,3,0,False,False
7,128.120000,69.090278,41497.7500000000,41497.7500000000,16711680,3,0,False,False

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,529 since Apr 2013
Thanks: 230 given, 854 received
Forum Reputation: Legendary


Martin,

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.

Regards,
ABCTG

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
AR Kansas
 
Futures Experience: Advanced
Platform: TradeStation, NinjaTrader, MultiCharts
Favorite Futures: Futures
 
Posts: 13 since Dec 2013
Thanks: 0 given, 7 received

It sounds like you need to look into using the StreamReader class instead of the ELC for this type of project

If you outline a desired example then we might be able to give an example code set as a solution to that problem

Reply With Quote
 
  #5 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received


ABCTG View Post
Martin,

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.

Regards,
ABCTG


Hello Chris

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

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
AR Kansas
 
Futures Experience: Advanced
Platform: TradeStation, NinjaTrader, MultiCharts
Favorite Futures: Futures
 
Posts: 13 since Dec 2013
Thanks: 0 given, 7 received

One trendline per file ?

You only need the starting and ending data to create a trendline in TS. Is that what your files will contain ?

Reply With Quote
 
  #7 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received


StratOpt View Post
One trendline per file ?

You only need the starting and ending data to create a trendline in TS. Is that what your files will contain ?

No
A file contain one string per trend line
No limit on trend lines ( string)

Martin

Reply With Quote
 
  #8 (permalink)
Trading Apprentice
AR Kansas
 
Futures Experience: Advanced
Platform: TradeStation, NinjaTrader, MultiCharts
Favorite Futures: Futures
 
Posts: 13 since Dec 2013
Thanks: 0 given, 7 received

Ok, the only data required to build the trendlines in TS is as follows

startDate, startTime, price, endDate, endTime, endPrice

You can cycle through a comma delimited file and build a series of trendlines using the StreamReader class and a TokenList

Let me get through this trading day and I will try to provide you a core example of such over the weekend.


Last edited by StratOpt; December 20th, 2013 at 12:38 PM.
Reply With Quote
 
  #9 (permalink)
Trading Apprentice
AR Kansas
 
Futures Experience: Advanced
Platform: TradeStation, NinjaTrader, MultiCharts
Favorite Futures: Futures
 
Posts: 13 since Dec 2013
Thanks: 0 given, 7 received

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.

 
Code
using elsystem;
using elsystem.io;
using tsdata.common;

inputs:
    Drive ( "C" ) ,
    FileLocation ( ":\" ),
    Unique ( "BuildTL" ),
    Extension ( ".txt" ) ;
variables: 
    string FileName ( "" ) ,
    string getLine ( "" )  ,   
    int Index ( 0 ),   
    TokenList TL( null ),		
    StreamReader sr ( null );

once begin
     FileName = Drive + FileLocation + Unique + Extension ;
     sr = StreamReader.Create( FileName ) ;
     
     while sr.EndOfStream <> true
     begin
         getLine = sr.ReadLine();
		
         if InStr( getLine, "," ) > 0 then
         begin
            TL = TokenList.Create( getLine ) ;				
            Index = TL_New( StrToNum( TL[0] ), StrToNum( TL[1] ), StrToNum( TL[2] ),
                            StrToNum( TL[3] ), StrToNum( TL[4] ), StrToNum( TL[5] ) );             
         end ;                   
     end ;

     sr.Close();
end ;

File format would be as follows. startDate, startTime,startPrice,endDate,endTime,endPrice

1131217,0900,1774.25,1131217,1500,1800.25
1131218,0900,1776.25,1131218,1500,1801.25
1131219,0900,1798.75,1131219,1500,1801.75


Last edited by StratOpt; December 20th, 2013 at 05:06 PM.
Reply With Quote
The following user says Thank You to StratOpt for this post:
 
  #10 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received



StratOpt View Post
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.

 
Code
using elsystem;
using elsystem.io;
using tsdata.common;

inputs:
    Drive ( "C" ) ,
    FileLocation ( ":\" ),
    Unique ( "BuildTL" ),
    Extension ( ".txt" ) ;
variables: 
    string FileName ( "" ) ,
    string getLine ( "" )  ,   
    int Index ( 0 ),   
    TokenList TL( null ),		
    StreamReader sr ( null );

once begin
     FileName = Drive + FileLocation + Unique + Extension ;
     sr = StreamReader.Create( FileName ) ;
     
     while sr.EndOfStream <> true
     begin
         getLine = sr.ReadLine();
		
         if InStr( getLine, "," ) > 0 then
         begin
            TL = TokenList.Create( getLine ) ;				
            Index = TL_New( StrToNum( TL[0] ), StrToNum( TL[1] ), StrToNum( TL[2] ),
                            StrToNum( TL[3] ), StrToNum( TL[4] ), StrToNum( TL[5] ) );             
         end ;                   
     end ;

     sr.Close();
end ;

File format would be as follows. startDate, startTime,startPrice,endDate,endTime,endPrice

1131217,0900,1774.25,1131217,1500,1800.25
1131218,0900,1776.25,1131218,1500,1801.25
1131219,0900,1798.75,1131219,1500,1801.75

Thank you StratOp

Question: Where do I get the StreamReader?

Martin

Reply With Quote
The following user says Thank You to arjfca for this post:

Reply



futures io > > > > > ElCollection: Want to understand

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to a file using Elcollection arjfca MultiCharts 2 December 18th, 2013 06:20 AM
I don't understand CME Book asynchronous Commodities Futures Trading 6 February 2nd, 2012 06:07 PM
Corporate Leaders Say They Understand Protests Quick Summary News and Current Events 0 October 18th, 2011 04:50 AM
trying to understand this . . . jmejedi The Elite Circle 4 January 30th, 2011 08:19 AM


All times are GMT -4. The time now is 12:45 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.13 seconds with 19 queries on phoenix via your IP 54.221.93.187