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

[amibroker] Re: Countdown Line Formula



PureBytes Links

Trading Reference Links

Yes!
Thank you ...




--- In amibroker@xxxxxxxxxxxxxxx, "Gordon Sutherland" <gosuth@xxx> 
wrote:
>
> Hello,
> 
> If you are referring to Daryl Guppy's Count Back Line (CBL) then the
> following code transcribed by Stephane Carrasset should do the 
trick (the
> AFL code plots OK on my machine).
> 
> Hope this helps,
> 
> Gordon Sutherland
> 
> 
> /* 	Stephane Carrasset's Countback Line (CBL) popularized by 
Daryl Guppy
> 		Refer to amibroker posting 30th December 2004 */
> 
> nR=2;
> Cbl[nR]=Null;
> bCBL=False;
> 
>     for( i=nR; i < BarCount; i++)
>     {
>         if( (Low[i-2]<Low[i-1]) && (Low[i-1]<Low[i]) )
>         {
>             Cbl[i] = Low[i-2];
>             bCBL = True;
>         }
>         else if (bCBL)
>         {
>             if (Low[i] < Cbl[i-1])
>             {
>                 Cbl[i] = Cbl[i-1];
>                 bCBL = False;
>             }
>             else
>             {
>                 n = nR;
>                 minval[i] = Low[i];
>                 breakloop= False;
>                 for (j = 1; NOT(breakloop) && j <= i; j++)
>                 {
>                     if (Low[i-j] < minval[i])
>                     {
>                         if (n>1)
>                         {
>                             minval[i] = Low[i-j];
>                             n--;
>                         }
>                         else
>                         {
>                             Cbl[i] = Low[i-j];
>                             breakloop=True;
>                         }
>                     }
>                 }
>                 if (Cbl[i] < Cbl[i-1])
>                 Cbl[i] = Cbl[i-1];
>             }
>         }
>         else
>         {
>             Cbl[i] = Cbl[i-1];
>         }
>     if (Cbl[i]==0)
>     Cbl[i] = Cbl[i-1];
>     }
> 
> Plot(Cbl,"",colorDarkGreen,1);
> Plot(C,"",-1,64);
> 
> 
> 
> 
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On Behalf
> Of murphybr2001
> Sent: Saturday, 1 March 2008 9:09 a.m.
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Countdown Line Formula
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "murphybr2001" <murphybr2001@> 
> wrote:
> >
> > Hi,
> > I have been trying for several days to try to translate the
> > Metastock code for Countdown Line Formula and can't seem to get 
it 
> to
> > work. If someone has the AFL code for it, or can translate
> > this for me I would be most appreciative...
> > 
> > CBLhi: 
> > 
> > HighDays := Input("Enter # days to cover last HIGH for CBL 
> calc'n:", 
> > 3, 55, 13); 
> > 
> >    If(HIGH < HHV(HIGH,  HighDays),                 {then ...}
> >    PREV,                                   {previous CBLhi, 
else...}
> >    If(Ref(L,-2) < Ref(L,-1) AND 
> >    Ref(L,-2) < L AND
> >    Ref(L,-1) < L, {then ...} Ref(L,-2),    {2nd day back low, 
> else...}
> >    If((Ref(L,-3)< Ref(L,-2) AND
> >    Ref(L,-3) < Ref(L,-1) AND
> >    Ref(L,-3) < L) AND
> >    (Ref(L,-2)< L OR 
> >    Ref(L,-1) < L),                        {then ... }
> >    Ref(L,-3),                             {3rd day back low, 
> else...}
> >    If((Ref(L,-4)< Ref(L,-3) AND
> >    Ref(L,-4) < Ref(L,-2) AND
> >    Ref(L,-4) < Ref(L,-1) AND
> >    Ref(L,-4) < L) AND
> >    (Ref(L,-3)< L OR
> >    Ref(L,-2) < L OR Ref(L,-1) < L),      {then... } 
> >    Ref(L,-4),                            {4th day back low, 
> else...} 
> >    If((Ref(L,-5)< Ref(L,-4) AND 
> >    Ref(L,-5) < Ref(L,-3) AND
> >   Ref(L,-5) < Ref(L,-2) AND
> >   Ref(L,-5) < Ref(L,-1) AND
> >   Ref(L,-5) < L) AND
> >   (Ref(L,-4)< L OR
> >   Ref(L,-3) < L OR
> >   Ref(L,-2) < L OR
> >   Ref(L,-1) < L),                {then ...}
> >   Ref(L,-5),                    {5th day back low, else...}   
> > PREV ))))) 
> > 
> > and for the CBL from a LOW 
> > 
> > CBLlo: 
> > 
> > LowDays := Input("Enter # days to cover last LOW for CBL 
calc'n:", 
> 3, 
> > 55, 13); 
> > 
> > If(LOW > LLV(LOW, LowDays), {then ...} PREV, {previous CBLlo, 
> > else...} If(Ref(H,-2) > Ref(H,-1) AND Ref(H,-2) > H AND Ref(H,-1) 
> 
> > H, {then ...} Ref(H,-2), {2nd day back high,else...} If((Ref(H,-3)
> 
> > Ref(H,-2) AND Ref(H,-3) > Ref(H,-1) AND Ref(H,-3) > H) AND (Ref
(H,-
> 2)
> > > H OR Ref(H,-1) > H), {then ... } Ref(H,-3), {3rd day back 
> > high,else...} If((Ref(H,-4)> Ref(H,-3) AND Ref(H,-4) > Ref(H,-2) 
> AND 
> > Ref(H,-4) > Ref(H,-1) AND Ref(H,-4) > H) AND (Ref(H,-3)> H OR Ref
> (H,-
> > 2) > H OR Ref(H,-1) > H), {then... } Ref(H,-4), {4th day back 
> > high,else...} If((Ref(H,-5)> Ref(H,-4) AND Ref(H,-5) > Ref(H,-3) 
> AND 
> > Ref(H,-5) > Ref(H,-2) AND Ref(H,-5) > Ref(H,-1) AND Ref(H,-5) > 
H) 
> > AND (Ref(H,-4)> H OR Ref(H,-3) > H OR Ref(H,-2) > H OR Ref(H,-1) 
> 
> > H), {then ...} Ref(H,-5), {5th day back high,else...} PREV )))))
> >
> 
> 
> 
> 
> 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/