Hi there.,
I am trying to make a working AFL to plot Rate Of Return based on a timeframe basis, in order to return a plot something like the one on this page as "Arith ROR(Periods): http://www.priceactionlab.com/Blog/2012/11/the-times-of-high-returns-in-holding-aapl-are-over/
I would like to make the AFL "TimeFrame ROC" selectable, no matter of the timeframe window currently selected.
My current AFL looks like this, but results has not been what I want to do:
I don't quite know if this is the right way to go, or if I need to write a "nested function" to expand or compress given the selected TimeFrame window.
Thanks for your Help Guys and Cheers!
I am trying to make a working AFL to plot Rate Of Return based on a timeframe basis, in order to return a plot something like the one on this page as "Arith ROR(Periods): http://www.priceactionlab.com/Blog/2012/11/the-times-of-high-returns-in-holding-aapl-are-over/
I would like to make the AFL "TimeFrame ROC" selectable, no matter of the timeframe window currently selected.
My current AFL looks like this, but results has not been what I want to do:
Code:
_SECTION_BEGIN("Rolling Arithmetic ROR");
PF = ParamField( "Price field" );
RP = ParamList("Rolling Cycle","Daily|Weekly|Monthly|Quarterly|Yearly",4);
P = Param("Rolling Periods", 1, 1, 360, 1 );
// VARIABLES
switch (RP) {
case "Daily" : R = TimeFrameGetPrice( "PF", inDaily, -P ); break;
case "Weekly" : R = TimeFrameGetPrice( "PF", inWeekly, -P ); break;
case "Monthly" : R = TimeFrameGetPrice( "PF", inMonthly, -P ); break;
case "Quarterly" : R = TimeFrameGetPrice( "PF", inQuarterly, -P ); break;
default : R = TimeFrameGetPrice( "PF", inYearly, -P ); break;
}
Plot( ROC( R, P), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
Thanks for your Help Guys and Cheers!