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

RE: [amibroker] Re: PREV



PureBytes Links

Trading Reference Links

Stan,
Here is code I found in the AFL Library for Guppy countback lines.
 
--------------------------begin code -------------------

/* 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,"Guppy Countback Line",colorGold,styleThick,1);



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Stan Graham
Sent: Wednesday, July 02, 2008 9:19 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: PREV

Thank you Tomasz I used PREV and the function seems to work OK,
except the line drawn on the chart doesn't seem correct, guess I got
it wrong. I'm trying to duplicate Guppys CountBack function, has
anyone already done this? I would realy appreciate seeing how to do
it! The MetaStock code is public and is as follows"

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 )))))

Hope someone can help, thank you.
StanG

--- In amibroker@xxxxxxxxxps.com, "Tomasz Janeczko" <groups@xxx>
wrote:
>
> Hello,
>
> The archive search reveals many posts about the same subject,
> including last one from May 28, 2008:
> http://finance.groups.yahoo.com/group/amibroker/message/124603
>
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Stan Graham" <asahi3@xxx>
> To: <amibroker@xxxxxxxxxps.com>
> Sent: Tuesday, July 01, 2008 8:00 PM
> Subject: [amibroker] PREV
>
>
> > Need help! Any one any idea how to replace the PREV function when
> > transposing a Metastock formula to AmiBroker? Would appreciate
any
> > help, thank ypou.
> > StanG
> >
> >
> > ------------------------------------
> >
> > 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




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

__,_._,___