();// 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 [email protected], "Tomasz Janeczko" <gro...@...> 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...@1 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 :) >
