No, because in this case end will be a different value for each of the bars in the lookback period; a new endpoint of a different regression line. You want to calculate the difference between the previous 40 closes and the current bars 40-bar regline. Hope I'm making sense;)
Johan --- In amibroker@yahoogroups.com, "timgadd" <[EMAIL PROTECTED]> wrote: > > Johan, > > I may have been over-enthusiastic in thinking that your code worked > as I had planned. The numerator (Direction) is fine. I'm not sure > that the denominator (Volatility) is working as planned. It's > definitely close. > > Assuming that the calculation for the "scatter" at the last point on > the linear regression line should be abs(Close - End), shouldn't the > following line return the same value for "Volatility" (the sum of the > scatter) at the last/end point? > > AddColumn(Sum(abs(Close-end),40),"Volatility Check"); > > 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 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/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/