PureBytes Links
Trading Reference Links
|
Stephane,
Here is my code for a Trendline Break System
I used this on MSFT 5min data
Let me know if this works OK. I tried to build it
so that it wouldn't look forward even though using
Peak() & Trough(), let me know if this is valid.
//*Trendline Break System*//
Filter=TimeNum()>080000 AND TimeNum()<=150000;
//PositionSize=2500;
PositionSize=BuyPrice*1000;
q=Optimize("q",1.4,1,2,.1);//.4/.2
p=Optimize("p",.8,.5,1.5,.1);//.2/.2
//p=.2;
s=IIf(Peak(C,p,1)==C,Peak(Close,p,3),Peak(C,p,2));
t=IIf(Peak(C,p,1)==C,Peak(Close,p,2),Peak(C,p,1));
u=IIf(Trough(C,q,1)==C,Trough(Close,q,3),Trough(C,q,2));
V=IIf(Trough(C,q,1)==C,Trough(Close,q,2),Trough(C,q,1));
w=IIf(Peak(C,p,1)==C,(PeakBars(C,p,3)-PeakBars(C,p,2)),(PeakBars
(C,p,2)-PeakBars(C,p,1)));
x=IIf(Peak(C,p,1)==C,PeakBars(C,p,3),PeakBars(C,p,2));
y=IIf(Trough(C,q,1)==C,(TroughBars(C,q,3)-TroughBars(C,q,2)),
(TroughBars(C,q,2)-TroughBars(C,q,1)));
z=IIf(Trough(C,q,1)==C,TroughBars(C,q,3),TroughBars(C,q,2));
slope=(t-s)/w;
slope2=(C-s)/x;
test1=Cross(slope2,slope)AND s>t AND C>t;//
slope3=(V-u)/y;
slope4=(C-u)/z;
test2=Cross(slope3,slope4) AND u<V AND C<V;//
Buy=Filter AND test1 ;
Sell=TimeNum()>150000;
Short=Filter AND test2 ;
Cover=TimeNum()>150000;
|