Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 10-26-2009, 06:05 PM   #25

Join Date: Oct 2007
Location: Pesaro
Posts: 25
Ignore this user

Thanks: 2
Thanked 5 Times in 5 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Tams »
are you talking about a 3 dimensional array?
Yes, you can build it with multiple arrays,
but no, it is not part of the EasyLanguage repertoire.
No, I don't think that waht I want to build is a 3 dimensional array.
I'm trying to build a Volume profile so it's a 2 dimensional array.
First dimension unlimited and unknown is the range of each day (High of the day - Low of the day) * price scale (or tick scale as you want)

Second dimensional array the volume of each level price (unknown )

So the final array is an array of the 2 first arrays each one unlimited.
The final array I think is a 2 dimensional array.
Is it possible ???
Or I must use ADE and maps collections ?

Thanks again
CrazyNasdaq
Crazynasdaq is offline  
Reply With Quote
Old 10-26-2009, 06:13 PM   #26

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,589
Ignore this user

Thanks: 2,026
Thanked 1,402 Times in 862 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Crazynasdaq »
No, I don't think that waht I want to build is a 3 dimensional array.
I'm trying to build a Volume profile so it's a 2 dimensional array.
First dimension unlimited and unknown is the range of each day (High of the day - Low of the day) * price scale (or tick scale as you want)

Second dimensional array the volume of each level price (unknown )

So the final array is an array of the 2 first arrays each one unlimited.
The final array I think is a 2 dimensional array.

...call it whatever you will, you should draw out the data dependencies on a grid... and see how each piece of data relate to each other.


Quote:
Is it possible ???

don't know, never tried it.

if you write out your thoughts in a step-by-step pseudo code,
e.g. one action per-line, one-line per-action,
you might be able to work out the code logics.
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 10-26-2009 at 06:25 PM.
Tams is offline  
Reply With Quote
Old 10-26-2009, 06:25 PM   #27

Join Date: Oct 2007
Location: Pesaro
Posts: 25
Ignore this user

Thanks: 2
Thanked 5 Times in 5 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Tams »
any 2 arrays that has a common or dependent element on another array is a 3-D array...





don't know, never tried it.

if you write out your thoughts in a step-by-step pseudo code,
e.g. one action per-line, one-line per-action,
you might be able to work out the code logics.
I'll try it and I write it here, so if you could help me in the step by step way maybe I'll make it faster and useful to anyone.
Maybe if I post my thoughts and my codes you or someone else could help me doing that and we can achieve a code on an indicator that many would like to have.
Thanks again for your time
CrazyNasdaq
Crazynasdaq is offline  
Reply With Quote
Old 10-26-2009, 06:35 PM   #28

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,589
Ignore this user

Thanks: 2,026
Thanked 1,402 Times in 862 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Crazynasdaq »
I'll try it and I write it here, so if you could help me in the step by step way maybe I'll make it faster and useful to anyone.
Maybe if I post my thoughts and my codes you or someone else could help me doing that and we can achieve a code on an indicator that many would like to have.
Thanks again for your time
CrazyNasdaq

before you start running, I would suggest you to learn to walk...
(I am famous for helping people to go from step 1 to step 2, but absolutely refuse to assist anyone to skip from step zero to step 3)

go through post #1 (which I know you haven't yet)...
and the tutorial in post #2,
then digest post #5

make a few exercises...

array is about data manipulation,
you have to be comfortable with a 2 dimensional array before you can work on a 3-D,
because a 3-D is exponentially more complex in structure and data tracking.
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...
Tams is offline  
Reply With Quote
Old 10-26-2009, 07:57 PM   #29

Join Date: Jan 2008
Location: San Francisco
Posts: 394
Ignore this user

Thanks: 17
Thanked 338 Times in 156 Posts



Re: Array (EasyLanguage)

CrazyNasdaq,

you do not need a 2 or 3d array for this. a programming friend of mine did this in Visual Basic and used a 1-dimensional dynamic array.

Here were the steps:

1) set up the basic array structure:

if 'this bar' is first bar of a new day (date>date[1]), clear out array and set counter variables to zero

if not a new day, then expand the existing array (the one created if the first if statement was true) to add new data, while preserving the existing array

I believe you do this using the EL syntax Array_SetMaxIndex(ArrayNa me, #Elements)

2) populate array. something like this:

barrange1 = ((high - Low) / 0.25)+1;
x=0
For Counter1 = 0 to barrange1
begin
bars1[x] = low +(0.25 * Counter1);
x=x+1
end;

note that the variable x is going to keep track of total elements in the array

the part I don't understand is how often you have to re-set the size of the array and/or preserve the array so it doesn't lose data elements within the array. the code I write invariably is out of bounds of the array or some syntax just isn't right. its damn hard to find supporting documentation on EL.
Frank is offline  
Reply With Quote
Old 10-27-2009, 06:34 AM   #30

Join Date: Oct 2007
Location: Pesaro
Posts: 25
Ignore this user

Thanks: 2
Thanked 5 Times in 5 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Frank »
CrazyNasdaq,

you do not need a 2 or 3d array for this. a programming friend of mine did this in Visual Basic and used a 1-dimensional dynamic array.

Here were the steps:

1) set up the basic array structure:

if 'this bar' is first bar of a new day (date>date[1]), clear out array and set counter variables to zero

if not a new day, then expand the existing array (the one created if the first if statement was true) to add new data, while preserving the existing array

I believe you do this using the EL syntax Array_SetMaxIndex(ArrayNa me, #Elements)

2) populate array. something like this:

barrange1 = ((high - Low) / 0.25)+1;
x=0
For Counter1 = 0 to barrange1
begin
bars1[x] = low +(0.25 * Counter1);
x=x+1
end;

note that the variable x is going to keep track of total elements in the array

the part I don't understand is how often you have to re-set the size of the array and/or preserve the array so it doesn't lose data elements within the array. the code I write invariably is out of bounds of the array or some syntax just isn't right. its damn hard to find supporting documentation on EL.
Thanks for the suggestion TAMS,
I've read again the posts in the first page and the tutorial (post #2).
Here is my way of doing it:
1) use a 1 tick chart with volume set to Trade volume and NOT tick count.
************************* ************
2) identify the range of each day (past and real time) and reset it each new day:

if date > Date[1] then begin
OpenDay = open;
HighDay = High;
LowDay = low;
CloseDay = close;
end;

If Date = date[1] then begin

If high > HighDay then
HighDay = High;
If Low < LowDay then
LowDay = Low;
if time >= Sess1endtime then
CloseDay = close;
If time < Sess1endtime and lastbaronchart then
CloseDay = close;
end;

RangeDay = HighDay - LowDay;
************************* *********************
3) Identify the numbers of rows for each price of the day range :

TickScale = minmove/priceScale;
NRows = RangeDay * (1/TickScale);
************************* *********************
4) Define the Array (1d dinamic array) regards volume:

MyVol = iff(bartype < 2, Upticks + Downticks, volume);
Array: MATRXIVoL[](0);

iVolume = MyVol;
iPrice = AvgPrice;

if date > date[1] then begin
Array_SetMaxIndex(MATRIX, NRows); // resize the array each day
MATRIXVoL[iVolume] = 0; // rest to zero each day
END;
************************* **********************
5) Populate the Array for the past days and for the real time day

if Date = Date[1] then begin
fro iPrice = 0 to (NRows-1) begin
MATRIXVoL[iVolume] = MyVol ;
END;

If AvgPrice = iPrice then begin
MATRIXVoL[iVolume] = MATRIXVoL[iVolume] + MyVol;
END;
************************* ***********************

These are my steps, but as a newbie about arrays, I'm not so sure about step #5, specially the last part {if AvgPrice = iPrice then begin ......ecc.....}

Then an other problem is:
If this way is correct a functional, how can I draw the Volume profile ??
Thanks again TAMS for your patience and your time.

P.S.
I have some ideas about the plotting and using ADE about this Volume profile, but it would be better to talk about it in private and then posting the final work.
If You want TAMS, write me in PVT to my TL private account.

Last edited by Crazynasdaq; 10-27-2009 at 06:47 AM.
Crazynasdaq is offline  
Reply With Quote
Old 10-27-2009, 10:33 AM   #31

Join Date: Oct 2007
Location: Pesaro
Posts: 25
Ignore this user

Thanks: 2
Thanked 5 Times in 5 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Crazynasdaq »
5) Populate the Array for the past days and for the real time day

if Date = Date[1] then begin
fro iPrice = 0 to (NRows-1) begin
MATRIXVoL[iVolume] = MyVol ;
END;

If AvgPrice = iPrice then begin
MATRIXVoL[iVolume] = MATRIXVoL[iVolume] + MyVol;
END;
************************* ***********************
This step (#5) is surely incorrect......

"for iPrice = 0 to (NRows-1) begin....... " is not the right way
iPrice can't be = 0 at least it can be :

for iPrice = HighDay downto LowDay begin
MatrixVoL[iVolume] = MyVol;
END;


Or another way (I don't know if the syntax is correct):

for iPrice = HighDay downto (HighDay - TickScale)=LowDay begin
MatrixVoL[iVolume] = MyVol;
END;

This step is the most difficult !!!

Last edited by Crazynasdaq; 10-27-2009 at 10:40 AM.
Crazynasdaq is offline  
Reply With Quote
Old 10-31-2009, 04:43 PM   #32

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,589
Ignore this user

Thanks: 2,026
Thanked 1,402 Times in 862 Posts



Re: Array (EasyLanguage)

Quote:
Originally Posted by Crazynasdaq »
This step (#5) is surely incorrect......

"for iPrice = 0 to (NRows-1) begin....... " is not the right way
iPrice can't be = 0 at least it can be :

for iPrice = HighDay downto LowDay begin
MatrixVoL[iVolume] = MyVol;
END;


Or another way (I don't know if the syntax is correct):

for iPrice = HighDay downto (HighDay - TickScale)=LowDay begin
MatrixVoL[iVolume] = MyVol;
END;

This step is the most difficult !!!

iPrice is the counter

the loop would only makes sense if you use the counter to cycle the instructions inside the loop.

e.g.
for iPrice = HighDay downto LowDay begin
MatrixVoL[iPrice] = MyVol(iPrice);
END;



p.s. I have not studied your code or logic, the above example is for LOOP illustration only, not a correction to your logics.
more on For loop can be found here:
FOR (EasyLanguage)
http://www.traderslaboratory.com/for...uage-7074.html
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
Crazynasdaq (10-31-2009)

Reply

Tags
array, easylanguage

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Buy at Open with Easylanguage cleon Coding Forum 5 03-02-2011 12:16 PM
Antonio: Please help me on MP for easylanguage nasdaq5048 Market Profile 13 09-23-2010 10:50 AM
Can function in TS8 return array? ImXotep Technical Analysis 5 05-25-2009 03:13 AM
MT4 Indicator Array Problem. ForexSurfr Coding Forum 0 02-16-2009 01:19 PM
Some EasyLanguage Help Please jjthetrader Coding Forum 8 06-02-2008 05:20 PM

All times are GMT -4. The time now is 08:08 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.