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

Re: [amibroker] Could someone point in the right direction...



PureBytes Links

Trading Reference Links

Hi - In 2nd arg of for loop header, you are assigning a value of zero 
instead of testing for it, so I am guessing the expression returns zero and 
so is never true. Might be easier to do this without a loop, something 
like...

InTrend = AlligatorGreen > AlligatorRed AND AlligatorRed > AlligatorBlue;
NotInTrend = NOT InTrend;
TrendBars = BarsSince( NotInTrend );


Steve

----- Original Message ----- 
From: "Tony" <talcamo@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 22, 2007 10:26 PM
Subject: [amibroker] Could someone point in the right direction...


> Hi,
>
> I am trying to write an exploration to loop back thru 3 arrays to
> confirm how many days ago there was a crossover of the 3 moving
> averages defined below. This is related the the Bill Williams Chaos
> Theory ( the alligator). Once the exploration is executed I would be
> able to see which stocks are still in an uptrend and have been in an
> uptrend for the longest time.
>
> However in my current formula, the for loop drops out on the very
> first pass. I cannot figure out why. It never adds anything to the
> NumberOfDays variable.
>
> I am certain the checkAlligator formula is correct as i tested it
> manually. I just added the ref() and the index counter for my
> formula, so it could loop back through the data.
>
> I would be gratefully if someone could explain to me what i a doing
> incorrectly? or point me in the correct direction.
>
> Thank you kindly in advance...
>
> Regards,
>
> Tony
>
>
> A=((H+L)/2);
>
> AlligatorBlue=Ref(Wilders(A,13),-8);
> AlligatorRed=Ref(Wilders(A,8),-5);
> AlligatorGreen=Ref(Wilders(A,5),-3);
> CheckAlligator = 0;
> NumberOfDays =0;
> for ( i=-1; stop = 0 ; i--)
> {
>
> CheckAlligator =IIf( Ref(AlligatorGreen,i) > Ref(AlligatorRed,i) AND
>                   Ref(AlligatorGreen,i) > Ref(AlligatorBlue, i) AND
>                   Ref(AlligatorRed,i) > Ref(AlligatorBlue, i) ,1, 0);
>
> // if in uptrend increment the NumberOfDays variable
> if (CheckAlligator == 1 )
>       NumberOfDays = 1 + NumberOfDays;
> else
>     stop = 1;
>
> }// end for loop
>
> Filter = C > 1;
> AddColumn(i  , "index ");
> AddColumn(Checkalligator  , "Checkalligator");
> AddColumn(NumberOfDays  , "NumberOfDays ");
> AddColumn(Close         ,  "Close");
> AddColumn(AlligatorGreen,  "AlligatorGreen");
> AddColumn(AlligatorRed,    "AlligatorRed");
> AddColumn(AlligatorBlue,  "AlligatorBlue");
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
>
>
> 




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
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/