PureBytes Links
Trading Reference Links
|
Both of these codes cross over funny when plotted.
The original code (using mt, not price) is the same as it was presented in
Futures magizine and maintains a much tighter band
Mark Brown wrote:
> YES! I sorry the original had a fixed input as close and I got carried away
> when replacing it with a user definable input. Of course I did it in the
> email before I sent it. MB
>
> It probably crossed over funny when plotted...
>
> >I think there is an error in the program. Shouldn't
> >
> >ut=alpha*price+(1-alpha)*ut
> >
> >read
> >
> >ut=alpha*mt+(1-alpha)*ut
> >
> >- Mark Jurik
> >-----------------------------------------------
> >
> >inputs:lookback(79),mult(2),price(c);
> >vars:alpha(0),mt(0),ut(0),dt(0),
> >mt2(0),ut2(0),dt2(0),but(0),blt(0);
> >alpha=2/(lookback+1);
> >mt=alpha*price+(1-alpha)*mt;
> >ut=alpha*price+(1-alpha)*ut;
> >dt=((2-alpha)*mt-ut)/(1-alpha);
> >mt2=alpha*absvalue(price-dt)+(1-alpha)*mt2;
> >ut2=alpha*mt2+(1-alpha)*ut2;
> >dt2=((2-alpha)*mt2-ut2)/(1-alpha);
> >but=dt+mult*dt2;
> >blt=dt-mult*dt2;
> >plot1(dt,"centerb");
> >plot2(but,"upperb");
> >plot3(blt,"lowerb");
> >
> >
> >
> >
|