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

Re: Backtest with Trendline.dll



PureBytes Links

Trading Reference Links

I was thinking to your question, and there is a "Half" solution in 
AFL


/*
x=cum(1);
startbar = LastValue( x-start );
endbar = LastValue(x- end );
Slope = (endval-startval)/(endbar-startbar);
line = Slope * (x-startbar) + startval; 
endbar-startbar=x-end -(x-start)=start-end
*/
slope= 
(Trough(L,7,2) - Trough(L,7,1)) /
(TroughBars(L,7,1) - TroughBars(L,7,2));
dip=
Trough(L,7,1) + slope * TroughBars(L,7,1);
Plot(dip,"",4,1);

/********Pic***********/
slope= 
(Peak(H,7,2) - Peak(H,7,1)) /
(PeakBars(H,7,1) - PeakBars(H,7,2));
pic=
Peak(H,7,1) + slope * PeakBars(H,7,1);
Plot(pic,"",5,1);
Plot(Close,"",1,64);

Buy=Cross(C,pic);
Plot(Buy*C,"",colorBlue,2);



> Thanks for the response although I must say that I find it a 
little 
> disheartening as I respect you as one of the Guru's of this Forum 
and 
> if you have not figured it out then I expect the odds of my doing 
so 
> have become very slim indeed, none the less I will not give up as 
I 
> am sure you have not either. It may be that we can't use the 
> trendline.dll but their may be other ways of accomplishing the 
same 
> end.
> 
> Many thanks to all the Guru's in this forum past, present, and 
future
> wdbaker8
> --- In amibroker@xxxx, "Stephane Carrasset" <nenapacwanfr@xxxx> 
wrote:
> > I have not found the solution myself
> > 
> > stephane
> > 
> > > Is it possible to backtest with trendline.dll?
> > > It appears that it only calculates the last trendline in the 
data 
> > set.
> > > 
> > > What I would like to be able to do is calculate the trendline 
> > between 
> > > to points at at time and the buy or sell when a future close 
> > violates 
> > > the trendline. I want to be able to backtest this.
> > > Any Ideas on how to do this??? The trendline.dll works 
beautiful 
> > on 
> > > the hard right edge but can't figure out how to backtest with 
it.
> > > 
> > > Here is an example of what I tried:
> > > 
> > > Filter=TimeNum()>=080000 AND TimeNum()<=150000; 
> > > PositionSize=2500;
> > > //*Buy___________________________________*//
> > > 
> > > start= PeakBars(C,1,2);
> > > end= PeakBars(C,1,3);
> > > LineSup =scTrendLine(C,C,end,start);
> > > test1= Close>Linesup;
> > > 
> > > Buy=Filter AND test1;
> > > Sell=TimeNum()>150000;
> > > //*Sell___________________________________*//
> > > 
> > > Short=0;
> > > Cover=0;
> > > 
> > > Thanks for your help
> > > Bill Baker