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

Reply
Old 09-29-2009, 07:50 AM   #1

Join Date: Dec 2008
Location: athens
Posts: 54
Ignore this user

Thanks: 0
Thanked 4 Times in 3 Posts

Variable Counter Array

hi guys

i have a counter based on a condition and what i would like to know is how to create an one dimentional array that will allign all the closing values when the counter value is 1..
(the counter value is one everytime the condition occurs).
the chart displays the counter values...

my question has to do with the kind of loop required to populate such an array..

so if the counter is mycounter and the array myarr i have tried

for j = 1 to mycounter begin
myarr[j] = c[j];
end;

also

if mycounter = 1 then
for j = 1 to mycounter begin
myarr[j] = c[j];
end;

but it didnot work...

any help on this will be much appreciated.
Attached Thumbnails
Variable Counter Array-counter-pic.png  
andypap is offline  
Reply With Quote
Old 09-29-2009, 08:18 AM   #2

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

Thanks: 17
Thanked 338 Times in 156 Posts

Re: Variable Counter Array

what do you mean by 'align all the closing values'? what do you want the indicator to plot?
Frank is offline  
Reply With Quote
Old 09-29-2009, 08:36 AM   #3

Tams's Avatar

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

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Variable Counter Array

Quote:
Originally Posted by andypap »
...
if mycounter = 1 then
for j = 1 to mycounter begin
myarr[j] = c[j];
end;

but it didnot work...

Tell me what is this SUPPOSED to do?
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 09-29-2009, 09:35 AM   #4

Join Date: Dec 2008
Location: athens
Posts: 54
Ignore this user

Thanks: 0
Thanked 4 Times in 3 Posts

Re: Variable Counter Array

suppose that the condition that sets the counter is a bullish key reversal..
and the array holds 20 elements..


every time a bullish key reversal happens the counter is 1 and incrementing by 1 for all the bars beteen key reversals..
when the counter resets to 1 the array is populated with the closing values of the last 20 keyreversals in the chart and will keep those values unchanged unill a new bullish key reversal appears ant the counter resets to 1 again..


i hope that this will be clear enough..


many regards
andypap is offline  
Reply With Quote
Old 09-29-2009, 09:38 AM   #5

Tams's Avatar

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

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Variable Counter Array

----- deleted by tams -----
__________________



Only an idiot would reply to a stupid post

Last edited by Tams; 09-29-2009 at 09:47 AM.
Tams is offline  
Reply With Quote
Old 09-29-2009, 09:50 AM   #6

Join Date: Dec 2008
Location: athens
Posts: 54
Ignore this user

Thanks: 0
Thanked 4 Times in 3 Posts

Re: Variable Counter Array

thanks for this answer but
what about arr[2] etc...

also 20 was an example
the array elements should be contolled via length input..

regards
andypap is offline  
Reply With Quote
Old 09-29-2009, 11:11 AM   #7

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

Thanks: 17
Thanked 338 Times in 156 Posts

Re: Variable Counter Array

I see,

what you want to do is preserve the array... at least that is how you do it Visual Basic ---

redim preserve array()


I am trying to find a resource for this on EL -- haven't found it yet.
Frank is offline  
Reply With Quote
Old 09-29-2009, 07:56 PM   #8

Join Date: Dec 2008
Location: athens
Posts: 54
Ignore this user

Thanks: 0
Thanked 4 Times in 3 Posts

Re: Variable Counter Array

thanks frank
i will appreciate much if you cross something like this to let me know..
i have tried so far a few different loops but i couldnot do it...
andypap is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array (EasyLanguage) Tams Coding Forum 44 01-26-2012 11:45 AM
Global Variable V2.2 Tams Trading Indicators 10 02-24-2010 01:23 PM
Array Question andypap Coding Forum 4 07-22-2009 02:45 PM
Can function in TS8 return array? ImXotep Technical Analysis 5 05-25-2009 02:13 AM
Tick Counter for Tradestation dow(n) Coding Forum 2 02-16-2008 04:17 PM

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