Hi Russ,
The MetaStock PREV function is a strange
function that represents the previous value of the function which contains it.
I chose to write a loop to calculate the indicator values. Your indicator
looks interesting; what is it called and how do you use it?
The following code was written for
readability to help explain the PREV function, not minimal code optimization (although
the code is fast as written):
// MetaStock Code
//
if(LinearReg(C,13)>PREV,if(LinearReg(C,13)-(ATR(13)*2.5)>PREV,
// LinearReg(C,13)-(ATR(13)*2.5),PREV),LinearReg(C,13));
periods = Param("periods", 13,2,100,1);
LR = LinearReg(C,periods);
LR_ATR = LR - (ATR(periods)*2.5);
MyInd = 0; // Indicator to calculate, MyInd[i-1] = MetaStock PREV
PREV = 0;
for (i=periods; i<BarCount;
i++) {
PREV[i] = MyInd[i-1];
if(LR[i] > PREV[i]) {
if(LR_ATR[i] > PREV[i])
MyInd[i]
= LR_ATR[i];
else
MyInd[i]
= PREV[i];
}
else
MyInd[i]
= LR[i];
}
Plot( MyInd, "My Indicator", ParamColor("My Ind color", colorRed ), ParamStyle("My Ind
style") );
Regards,
David
From:
amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of russ_shor
Sent: 02/28/2007 7:40 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help re
converting metastock code
Hi re a lower deviation metastock can someone help
convert to
Amibroker. I use version 4.6
Metastock code:
If(LinearReg(c,13)>PREV,If(LinearReg(C,13)-(ATR(13)*2.5)>PREV,LinearReg(C,13)-(ATR(13)*2.5),PREV,LinearReg(C,13));
__._,_.___
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
__,_._,___