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

Re: Calculating trend line values



PureBytes Links

Trading Reference Links

Thanks for the explanation, Stephan.

Bill


--- In amibroker@xxxx, "elstephel" <elstephel@xxxx> wrote:
> --- In amibroker@xxxx, "eseward_2000" <eseward_2000@xxxx> wrote:
> > Just wondering...
> > 
> > Shouldn't it be: pred = slope + Ref(TrV,+1); // +1?
> > 
> > Or am I missing something? Appreciate any corrections to my 
thinking.
> > 
> > Bill
> 
> No, the slope has to be added to the last known value of the 
trendline to calculate next value. The last value is in my code the 
value of yesterday (Ref(TrV,-1)). "pred" calculates todays value.
> 
> Stephan
> 
> 
> > 
> > 
> > --- In amibroker@xxxx, "elstephel" <elstephel@xxxx> wrote:
> > > --- In amibroker@xxxx, "epintoem" <epintoem@xxxx> wrote:
> > > > How can I calculate the next value of the trendline given the 
> > previous
> > > > 2 days data?
> > > 
> > > //TrV is trendline value
> > > 
> > > slope = Ref(TrV,-1) - Ref(TrV,-2);
> > > pred = slope + Ref(TrV,-1);// "prediction" of the next 
trendline 
> > value
> > > 
> > > //**end of code
> > > 
> > > works with rising and falling trendlines 
> > > 
> > > HTH
> > > 
> > > Stephan