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

[amibroker] Re: endless loop



PureBytes Links

Trading Reference Links

for ( i=0; i < Continue_check ; i--) is wrong.

it should be:
for ( i=0; i < Continue_check ; i++)
or:
for ( i=Continue_check; i >0; i--)
________________________________________________________________________
--- In amibroker@xxxxxxxxxxxxxxx, "Tony" <talcamo@xxx> wrote:
>
> Hi,
> 
> Hoping someone can help me.
> I have been trying to create an exploration which computes the 
number 
> of days 3 moving averages are above each other ( Bill Williams 
> alligator).
> 
> I have coded the following but getting an endless loop 
> condition...see code below.
> 
> Could someone kindly explain to me what I am doing incorrectly.
> Might there be an easier methof to do this?
> 
> Thank you in advance for your consideration.
> 
> Tony
> 
> 
> outsidebar = Outside();
> insidebar = H <= Ref(H,-1) AND L >= Ref(L,-1);
> upbar = H > Ref(H,-1) AND L >= Ref(L, -1);
> downbar = L < Ref(L,-1) AND H <= Ref(H,-1);
> barcolor=IIf(outsidebar, 1, IIf(downbar, 4, IIf(upbar,27, 6) ) );
> A=((H+L)/2);
> 
> AlligatorBlue=Ref(Wilders(A,13),-8);
> AlligatorRed=Ref(Wilders(A,8),-5);
> AlligatorGreen=Ref(Wilders(A,5),-3);
> 
> Continue_check= 365;
> CheckAlligator= 1;
> NumberOfDays = 0;
> for ( i=0; i < Continue_check ; i--) 			
> {								
> 			
> CheckAlligator =IIf( Ref(AlligatorGreen,i) > Ref(AlligatorRed,i),1, 
>                 IIf(Ref(AlligatorRed,i) > Ref(AlligatorBlue,i   )
>                          ,1,0) );
> 
>     if (CheckAlligator = 1 )
>        NumberOfDays = 1 + NumberOfDays;
>    else
>      i== 365;
> 
> }// end for loop
> 
> Filter = C > 1;
> 
> 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

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