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

Re: [amibroker] Help with coding PREV alternative



PureBytes Links

Trading Reference Links

This has been discussed many times in the past on the forum
assuming I understand what you are trying to do


IH_Periods = Param("Initial High", 21, 10, 100,1);
HH = IH_Periods - 1;

A = C;
B = O;
Z = HHV(H,HH);

prev = Z;

for(i=1;i<BarCount;i++)
{
if(A[i] > B[i]) prev[i]= Z[i];
else prev[i] = Z[i-1];

}

-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 20/02/07, Keith Osborne <kosborn3@xxxxxxxxxxxxxx> wrote:
> Hi, I am attempting to convert a Metastock formula with a PREV
> statement. I have read a number of messages in Amibroker database and my
> attempt is as follows.
>
> IH_Periods = Param("Initial High", 21, 10, 100,1);
>
> HH = IH_Periods - 1;
>
> Z = HHV(H,HH);
> Z = 0; // Initialize
> for(i=1;i<BarCount;i++)
> {
> PREV = Z[i-1]; // PREV is previous value of Z.
> }
>
> When I use PREV in a AB formula such as iif(A > B, XX, PREV) I get 0
> (Zero) when A<B.......rather than the previous value of Z. Can I assign
> a HHV to Z?)
>
> I hope I have explained this.
>
> Any help would be appreciated.
>
> TIA .... Keith
>
>
> 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
>
>
>
>

Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/693 - Release Date: 2/19/2007 5:01 PM