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

Re: [amibroker] Re: please read this formula and tell what it is?


  • Date: Fri, 4 Dec 2009 08:53:05 -0500
  • From: "wavemechanic" <fimdot@xxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: please read this formula and tell what it is?

PureBytes Links

Trading Reference Links



There is a book used by many community colleges in self study C++ courses that would probably work for many - C++ Demystified (A Self-Teaching Guide).
 
Bill
----- Original Message -----
From: Ted Byers
Sent: December 03, 2009 3:46 PM
Subject: Re: [amibroker] Re: please read this formula and tell what it is?



On Thu, Dec 3, 2009 at 2:56 PM, Mike <sfclimbers@xxxxxxxxx> wrote:
 

Ted,

AFL is like C++ only in the sense that C++ is like C. All of what you have helpfully described exists in C, without need of any of the object oriented constructs of C++.


True enough.

Studying C++ would probably confuse a non programmer. If opting to study another language, I suspect that C would be the better choice.


C would certainly be much simpler as an introduction but good luck finding a decent introductory book talking only about C.  I haven't seen one in what seems like eons.  I have several books on C, but wouldn't recommend any of them, particularly for non programmers.  The books I like best for an introductory course in programming happen to be written to introduce C++.  Although I use Java for often these days than C++ (for web applications), I have yet to find a good introductory text that uses it.  All the really good Java books I have found assume the reader already has a solid programming background.

A day or two ago, I found something on the AmiBroker site, I think referring to advanced use of AmiBroker in back testing, that includes some discussion of, and a very simplistic description of, object oriented programming.  I have not examined AFL enough to know if it includes support for defining classes, or if the extent of object oriented programming is limited to the use of predefined objects, but either way, I think exposure to the object oriented constructs of C++ would help in understanding that material, particularly if a well written and well designed (from the perspective of instructional systems design) book like that written by Koenig and Moo is used.

On a side note, on reading that object oriented material, I began to wonder if one could use the back testing object to support meta-analyses, or if that object is implemented as a singleton.  What I mean is this.  Suppose you have a function of several parameters that implements a trading system you want to test (say one that chooses between trend following and mean reversion based on the directional index being above or below some threshold, represented in on of the parameters you want to optimize and some measure of volatility being above or below some other threshold, in another of the parameters you want to optimize).  Then suppose you want to do apply a walk forward optimization, applying the result of a given optimization on some sample to an out of sample period immediately following.  My question is, can you make use of a second (or higher) level of optimzation where, for example, the parameters to optimize are the respective lengths of the in sample and out of sample periods?  And if the answer to that is yes, can one do the walk-forward procedure on that level too, so the algorithm one ends up with can adapt to whatever change may happen in the underlying model system as new data arrives.  I know exactly how I'd do that in C++ using a blend of object oriented program with generic programming and a bit of template metaprogramming thrown in.  But can I do it in AFL?

Cheers,

Ted
 

And yes, using IIF would be more efficient than a loop.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, Ted Byers <r.ted.byers@xxx> wrote:


>
> On Thu, Dec 3, 2009 at 1:15 PM, bistrader <bistrader@xxx> wrote:
>
> >
> >
> > i is element of array; i++ is counter for "for" statement. Loop goes thru
> > all values. Better, in my opinion, is iff as defined below.
> >
> > Not quite.
>
> If you're going to write a program or script, you have to be more precise
> than that. 'i' is not an element of the array. Rather it is an index
> referring to an element of the array (the precise concept of what 'i' is
> depends on what programming language you're using, but what I have given
> here is good enough for someone beginning his exposure to programming using
> AFL). 'i++' is not a counter. Rather it is a statement applying the unary
> operator '++' to the index 'i'. It is correct, though, that it loops
> through all the elements of the array.
>
> A for loop in AFL (and in C++ and Java and a number of related languages)
> has a structure you need to understand. That is "for (initialization code ;
> test ; end code)". You can see that in action in your example. "i = 0"
> creates and initializes your index variable. "i < *BarCount"* verifies that
> 'i' always has a value less than 'BarCount'. If this test fails (returns
> false) the _expression_ 'Close[i]' would refer to an element that is not in
> the array. This test, therefore, ensures that the loop operates only on
> elements that really exist in the array. The end code 'i++' increments the
> value of 'i' by one after all the work in the loop is complete, and
> basically restarts the loop with the incremented value of 'i' (so once it is
> finished with one element in the array it can work on the next). This keeps
> going until 'i' has the same value as 'BarCount - 1' . At the end of the
> loop where 'i' has that value, it is given the value 'BarCount', and the
> test fails. At that point, execution resums on the next executable
> statement after that body of the loop.
>
> I could be wrong, but my impression on a first examination of AFL is that a
> large proportion of the syntax and semantics of AFL is borrowed from C++.
> If 'learner' is unfamiliar with programming, any introductory text on C++
> may be helpful in understanding more fully AFL. Having had some experience
> teaching software engineering, I would not regard the documentation provided
> with AmiBroker or in the books related to it as a suitable introduction to
> programming using AFL (rather, those seem more appropriate as a reference
> for someone who is already a reasonably proficient programmer). If the
> developers of AmiBroker are inclined to accept advice from someone like me,
> I'd suggest an extra book that would take the description of AFL, provided
> in the Introduction to AmiBroker, and expand it into a book that could serve
> as an introductory programming book that happens to use AFL (using one of
> Stroustrup's books on C++, or Koenig and Moo's book on C++ as a model).
>
> I won't comment on the relative benefit of the function 'iff' as I have not
> tested it or executed benchmarks using it.
>
> HTH
>
> Ted
>
>
> >
> > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%40yahoogroups.com>, "Ton

> > Sieverding" <ton.sieverding@> wrote:
> > >
> > > What about :
> > >
> > > color = iif(C>0,colorgreen,colorred);
> > >
> > > Regards, Ton.
> > >
> > > ----- Original Message -----
> > > From: Joe Landry
> > > To: amibroker@xxxxxxxxxxxxxxx <amibroker%40yahoogroups.com>
> > > Sent: Thursday, December 03, 2009 3:28 PM
> > > Subject: Re: [amibroker] please read this formula and tell what it is?
> > >
> > >
> > >
> > >
> > > Is this a test?
> > > Joe
> > > ----- Original Message -----
> > > From: learner
> > > To: amibroker@xxxxxxxxxxxxxxx <amibroker%40yahoogroups.com>
> > > Sent: Thursday, December 03, 2009 8:12 AM
> > > Subject: [amibroker] please read this formula and tell what it is?
> > >
> > >
> > >
> > > for( i = 0; i < BarCount; i++ )
> > > {
> > > if( Close[ i ] > Open[ i ] ) // CORRECT
> > > Color[ i ] = colorGreen;
> > > else
> > > Color[ i ] = colorRed;
> > > }
> > >
> > >
> > >
> > >
> > >
> > > please read above formula and tell me what is i and i++
> > > what it does exactly?
> > > thankyou for support
> > >
> >
> >
> >
>
>
>
> --
> R.E.(Ted) Byers, Ph.D.,Ed.D.
> TED@xxx

> CTO
> Merchant Services Corp.
> 350 Harry Walker Parkway North, Suite 8
> Newmarket, Ontario
> L3Y 8L3
>




--
R.E.(Ted) Byers, Ph.D.,Ed.D.
TED@xxxxxxxxxxxxxxxxxxxxxxx
CTO
Merchant Services Corp.
350 Harry Walker Parkway North, Suite 8
Newmarket, Ontario
L3Y 8L3


__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___