PureBytes Links
Trading Reference Links
|
This may be what you are looking for:
//gives each bar's previous Close
priorClose = Ref(Close, -1);
// Reset 1st value of CLOSE and prior CLOSE
priorClose[0] = 0;
Close[0] = 0;
priceChange = Close / priorClose;
//gives each bar's price-change logarithm, corrected for NaN and
Infinite
logPC = log(priceChange);
logPC = IIf(IsNull(logPC) OR NOT(IsFinite(logPC)), 0, logPC);
//gives cumulative logarithm for each bar
CumLogs = Cum(logPC);
//gives average cumulative logarithm for each bar
meanLog = CumLogs / BarIndex();
//gives each bar's detrended close
detrendedClose = Close - meanLog;
// plots the close with solid line
Plot(detrendedClose,"Detrended Close",colorBlack,styleLine);
Plot(Close, "Close", colorRed, styleLine);
// debug values
printf("close0=" + WriteVal(Close[0]) + "\n");
printf("priorclose[0]" + WriteVal(priorclose[0]) + "\n");
printf("priorClose=" + WriteVal(priorClose) + "\n");
printf("Barindex=" + WriteVal(BarIndex()) + "\n");
printf("Close=" + WriteVal(Close) + "\n");
printf("pricechange=" + WriteVal(pricechange) + "\n");
printf("logpc=" + WriteVal(logpc) + "\n");
printf("cumlogs=" + WriteVal(Cumlogs, 1.4) + "\n");
printf("meanlog=" + WriteVal(meanlog, 1.4) + "\n");
printf("detrendedclose=" + WriteVal(detrendedclose) + "\n");
------------------------------------
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/
|