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

RE: [amibroker] Help with coding PREV alternative



PureBytes Links

Trading Reference Links

you have assign z = 0; the whole z array equal to 0, so z[i -1] is of course
0;
try z[0] = 0 instead and use prev[i] instead of constant PREV.

  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Keith Osborne
Sent: Tuesday, 20 February 2007 2:54 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help with coding PREV alternative



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


 

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