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

-->To Mike --> Re: [amibroker] Re: Aronson Detrending Market {Was Detrending...



PureBytes Links

Trading Reference Links

Hi,

That is not quite what Aronson was describing. Aronson was describing 
the removal of trend from data covering a fixed period such that 
backtested results on that period could be evaluated without the 
effects of market trend.

To do so, the log daily mean of the *entire period* is subtracted 
from each log daily change in that period (i.e. the same value is 
subtracted from the first bar as is subtracted from the last bar and 
every bar in between).

The end result is that the mean of the adjusted values for that 
period will equal zero. In other words no presence of trend at all. 
As such, any gains produced by the strategy will be attributable only 
to the strategy itself, and not to overall market trend.

If I understand your code correctly; You are subtracting a different 
mean from each bar, based on the data that came before it, rather 
than based on the range under study. For any range, the mean of the 
adjusted values produced by your formula will not be zero and thus is 
not what Aronson was doing.

However, what you have produced may prove to be a handy indicator. 
Thanks for the contribution.

Mike
 
--- In amibroker@xxxxxxxxxxxxxxx, "thomasdrewyallop" <drewyallop@xxx> 
wrote:
>
> 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/