PureBytes Links
Trading Reference Links
|
hello,
http://www.tradertalk.com/tutorial/demark.html , these were the
original rules .thats modified
```` Natasha !!!!
On 1/10/07, Nick Busigin <nick@xxxxxxxxx> wrote:
>
> Hi Ed and AmiBrokerites,
>
> I'm still a little green around the edges when it comes to programming
> in AFL, so I would like to ask the Ed and the other experienced coders a
> question or two in order that I have a better understanding of the
> symantecs and syntax of the AFL language. I'll use the code that Ed
> posted to the list a little while ago as a basis for my questions:
>
> On Mon, 1 Jan 2007, Edward Pottasch wrote:
>
> > ... Someone mentioned Dimitris Tsokakis who often posted very
> > interesting code. Here is some of his ingenious code that triggered
> > an idea for a system I currently use,
> >
> > rgds, Ed
> >
> > // Generalised Sequential buy/sell signals
> > SetChartOptions(0, chartShowDates);
> > GraphXSpace = 5;
> > Plot(C,"C",colorWhite,64);Title=Name()+",";
>
> I understand what the above does. It's what's in the loops that I find
> a little confusing, with regard to arrays and scalars.
>
> Here's how Nick (the AFL greenhorn) parses the code within the for loop:
>
> > for(x=5;x<25;x++)
> > {
> > b2=Sum(C<Ref(C,-3),x)==x;
>
> 1) 'x' is a scalar variable, (the iterator variable of the for loop).
>
> 2) 'C' is an array variable of all the closing prices
>
> 3) 'Ref(C,-3)' is an array with the closing prices shifted forward
> by 3 bars (ie. for each position in C, it evaluates to the value in
> the C array from 3 bars ago).
>
> 4) 'C<Ref(C,-3)' evaluates to an array which has TRUE (represented by
> a numeric constant 1) elements whenever a closing price bar of the
> array C has a value that is less than the closing price from 3
> bars ago.
>
> Question: When you are comparing C with Ref(C,-3), what are
> the first 3 values in the Ref(C,-3) array? Are they
> undefined or do they have some default value in them?
> It seems to me that the comparison of C and Ref(C,-3)
> is only valid from the 4th element of C and onward.
> Am I correct in my thinking here?
>
> 5) 'Sum(C<Ref(C,-3),x)' This statement appears to depend on the value
> of TRUE, which in AFL I am assuming is always equal to numeric
> constant 1. So, it evaluates to an array in which each element is
> the sum of the previous x elements, ie. a count of how many times
> in the past x elements, the closing price was less than the closing
> price 3 bars ago.
>
> 6) 'Sum(C<Ref(C,-3),x)==x' evaluates to an array or TRUE (1) or
> False (0) elements, where a TRUE element represents a bar that
> is the x'th bar of a consecutive series of x closes, each of which
> having a closing price less than the closing price 3 bars before it.
>
> Question: In this expression, there is a mix of array variables
> and expressions and a scalar variable 'x'. Am I
> correct in assuming that scalar 'x' is temporarily
> promoted to an array in which every element is equal
> to the scalar value held in 'x'?
>
> 7) 'b2' is an array which contains values of True (1) or False (0).
> Wherever there is a TRUE element, there has been a run of x bars,
> each having a closing price less than the close 3 bars prior.
>
> Question: What are the first x elements of b2? Are they
> undefined or can I expect them to have some default
> value in them?
>
> > Buy=b2==0 AND Ref(b2,-1);
>
> 8) Here the Buy array is assigned valued of TRUE (1) or FALSE (0).
> An element of BUY is true if the the current element of b2 is 0
> (FALSE) and if follows an element which is 1 (TRUE) - which
>
> I interpret this as follows: Buy when there the previous bar
> concludes a run of x closes, each of which had a closing price
> less than the close 3 bars ago AND where the current bar has
> broken that pattern and the price hasn't dropped as much or is
> starting to rise.
>
> Question: How am I doing so far?
>
> I'll stop asking questions here because it's probably enough for now and
> also because I'm confused as to why the Buy array assignment statement
> and the following three statements are within a for() loop.
>
> Thanks in advance to those that take the time to help a greenhorn!
>
> Nick
>
> > PlotShapes((shapeHollowSmallCircle)*b2,x);
> > PlotShapes(shapeUpArrow*Buy,colorWhite,0,C,0 );
> > Title=Title+WriteIf(b2,"b["+WriteVal(x,1.0)+"]","");
> > }
> >
> > for(x=5;x<25;x++)
> > {
> > S2=Sum(C>Ref(C,-3),x)==x;
> > Sell=s2==0 AND Ref(s2,-1);
> > PlotShapes((shapeHollowSmallCircle+shapePositionAbove)*s2,x);
> > PlotShapes(shapeDownArrow*Sell,colorYellow,0,C,0 );
> > Title=Title+WriteIf(s2,"s["+WriteVal(x,1.0)+"]","");
> > }
> >
> --
>
--
Warm Regards;
`````` Natasha !!!
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007 4:35 PM
|