[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: A shorter syntax to reference past elements of array



PureBytes Links

Trading Reference Links

();// class functions (reserved for processes and procedures)

[]; class arrays (reserved for referencing array elements)


Array class examples:

C[5];//fifth element of the C array (absolute nomenclature)

[C,-5];//fifth element back from the 'current' bar (relative 
nomenclature)

[array of arrays,parameter];//matrix nomenclature reserved for future 
matrix use.

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> 
wrote:
>
> Re[2]: [amibroker] Re: A shorter syntax to reference past elements 
of arrayYes I would agree, and I was thinking about that too and 
liked it, but implementing this would
> a) potentially break existing code (if anybody uses H1 or similar 
for any other purpose)
> b) potentially cause the same confusion as C@x or C#1 (positive 
number for referring past)
> 
> Similar solution is C.1 , H.1 (using dot "member of") and althogh 
it does not suffer from a)
> it suffers from b). And no, C.-1 is not an option, since it is 
visually to similar to C-.1 
> (which is valid statement Close - 0.1 )
> 
> All in all, it seems that it would be hard to come up with solution 
that would please everybody.
> 
> Theoretically just predefining 5 variables O1, L1, H1, C1, V1 just 
for "previous bar value of OHLC"
> should address 90% of most common "easy" situations, and then a) is 
not a big problem
> since it is only 5 variables.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
>   ----- Original Message ----- 
>   From: Herman 
>   To: Graham 
>   Sent: Friday, February 20, 2009 1:59 AM
>   Subject: Re[2]: [amibroker] Re: A shorter syntax to reference 
past elements of array
> 
> 
>   fwiw, I routinely define these values at the top of my code:
> 
> 
> 
> 
>   O1         = Ref(O,-1);
> 
>   L1         = Ref(L,-1);
> 
>   H1         = Ref(H,-1);
> 
>   C1         = Ref(C,-1);
> 
> 
> 
> 
>   and also sometimes O2,... O3, ... and so on. dito for other often 
used statements. 
> 
> 
> 
> 
>   NONE of the suggested formats can beat this!
> 
> 
> 
> 
>   herman
> 
> 
> 
> 
> 
> 
> 
>   Thursday, February 19, 2009, 7:36:01 PM, you wrote:
> 
> 
> 
> 
>   > I think using the Ref should be kept just the way it is. I 
cannot see
> 
>   > how any alternative method would be less confusing to newbies.
> 
> 
> 
> 
>   > btw you can change
> 
>   > P = (Ref(H,-1) + Ref(L,-1) + Ref(C,-1)) / 3;
> 
>   > to
> 
>   > P = Ref(H+L+C,-1) / 3;
> 
>   > and thus reduce the amount of typing :)
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/