[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

After reading thru all the messages on this, I agree on the logic and
beauty of '@'.

Merits of '@':

It has no other current use, so nothing can break and no confusion can
be introduced

It can operate on expressions from both left and right sides, making
it more useful - an actual enhancement rather than a mere typing shortcut.

As a typing shortcut, it's the shortest!  (just a single char)

Thinking-wise it is very logical - like a number-line

   @-5     means at 5 to the left
   @5      means at 5 to the right


Thanks to TJ, Marcin, Markus, Dennis, and Brian for making salient points!


--- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@xxx> wrote:
>
> Ah, I see the logic in using that @/# syntax for the symmetry now and  
> lack of confusion.  It has an elegance and is actually shorter as a  
> shortcut.  Just a normal operator called array shift.  In C++ they use  
>  >> and << operator for bit shifting operation.  I did not see any @  
> or # operators used.  Perhaps a double character operator that looks  
> like shifting would have some merit.  I don't see a <> operator used  
> (it is used in some languages as !=).
> C <> 5
> C <> -5
> 
> I would like to see shorter versions of some commonly used functions  
> to make my lines shorter and more readable, but it does not really  
> matter to me if they are there or not.  My program will run either  
> way.  I would much rather have new functions that do something I can  
> not otherwise do.
> 
> BR,
> Dennis
> 
> On Feb 19, 2009, at 2:13 PM, Tomasz Janeczko wrote:
> 
> > Hello,
> >
> > With all variants the shift could be an array.
> >
> > The difference is that with identifer( shift ) syntax, the  
> > identifier must be
> > the variable identifier, not anything else, because of ambuiguity  
> > when used with
> > expressions.
> >
> > However @ and # operators would be able to operate on expressions from
> > both left and right side. As for parentheses, they won't be required  
> > as long
> > as you don't want to change the precedence. The idea was that @/#  
> > operator
> > would have precedence equal to ^ (raising to a power), so would be  
> > executed
> > before addition/subtraction and multiplication and division.
> >
> > With regards to () syntax, Marcin has pointed out some possible
> > confusion created by coding like this:
> >
> >
> > Plot( RSI( 14 ), "RSI14", colorRed);
> > myRSI = RSI( 20 );
> > Plot( myRSI( 5 ), "myRSI", colorBlue);
> >
> > All in all, although () syntax looks best when applied to close/open/ 
> > high/low,
> > it does create confusion when (ab)used :-) as above.
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "markhoff" <markhoff@xxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Thursday, February 19, 2009 7:37 PM
> > Subject: [amibroker] Re: A shorter syntax to reference past elements  
> > of array
> >
> >
> >>
> >> Tomasz, just one question: is the bar shift limited to fixed numbers
> >> or will it also be possible to use variables or expressions, e.g.:
> >>
> >> a) c@x
> >> b) c@x+k
> >> c) c@(i+k)
> >>
> >> Will the parenthesis be required for expressions?
> >>
> >> Regards,
> >> Markus
> >>
> >> --- In amibroker@xxxxxxxxxxxxxxx, "markhoff" <markhoff@> wrote:
> >>>
> >>>
> >>> Even it seems that the proposal C() is in favor by most people, I'm
> >>> not convienced that using parenthesis is a good idea, since it might
> >>> cause confusion with function calls. Ref() is an internal function,
> >>> but I don't like to see reserved keywords like C or Close used  
> >>> like a
> >>> function as it would be for C() or Close(). My choice therefore is  
> >>> C@x
> >>> (easy reading "Close AT 5 bars back").
> >>>
> >>> Regards,
> >>> Markus
> >>>
> >>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> As a convenience feature I was contemplating for some time to allow
> >>>> shorter syntax to very common operation of referring to past
> >>> elements of the array.
> >>>> As you now current syntax to refer to past is:
> >>>>
> >>>> Ref( array, -bars )
> >>>>
> >>>> So close five bars back is Ref( C, -5 )
> >>>>
> >>>> I don't have any technical problem with adding new operator that
> >>> will make it shorter,
> >>>> but I am wondering about the most preferrable "form",
> >>>> that is easy to use and does not create confusion.
> >>>>
> >>>> So I would like to ask you which
> >>>> "short form" would you prefer.
> >>>> - C@x
> >>>> - C#5
> >>>> - C(5)
> >>>> - I don't like the idea at all
> >>>>
> >>>> Please use this poll to vote:
> >>>> http://finance.groups.yahoo.com/group/amibroker/surveys?id=2828485
> >>>>
> >>>> Thank you.
> >>>>
> >>>> Best regards,
> >>>> Tomasz Janeczko
> >>>> amibroker.com
> >>>>
> >>>
> >>
> >>
> >>
> >>
> >> ------------------------------------
> >>
> >> **** 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
> >>
> >>
> >>
> >
> >
> > ------------------------------------
> >
> > **** 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
> >
> >
> >
>




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

**** 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/