PureBytes Links
Trading Reference Links
|
Below is the code I am using in IB for automatic trendlines. However,
I cannot use the same code in backtester.
Any solution?
X=Cum(1);
D=1;// CHANGE 1 WITH 2, 3 etc
for( d = 1; d <= 2; d++ )
{
bc=d+40;
bc1=d+41;
condP=Ref(H,-1)>=Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-3);
P=Ref(CONDP,1)*(X!=LastValue(X));
endt= LastValue(ValueWhen( P, x, D ));
endS = LastValue(ValueWhen( P, H, D ) );
startt=LastValue(ValueWhen( P AND H>ends AND X<ENDT, x, 1 ));
startS = LastValue( ValueWhen( P AND H>ends AND X<ENDT, H, 1 ));
dtS =endt-startt;
aS = (endS-startS)/dtS;bS = endS;
tH = aS * ( x -endt ) + bS;
tH1=IIf(X>STARTT-30,tH,-1E10);
Plot(tH1,"",bc,1);
condT=Ref(L,-2) >= Ref(L,-1) AND L>Ref(L,-1) AND Ref(L,-1)<Ref(Close,-
3);
T=Ref(CondT,1)*(X!=LastValue(X));
Plot(C,"",4*P+3*T+1,64);
endtT= LastValue(ValueWhen( T, x, D ));
endST = LastValue(ValueWhen( T, L, D ) );
starttT=LastValue(ValueWhen( T AND L<endsT AND X<ENDTT, x, 1 ));
startST = LastValue( ValueWhen( T AND L<endsT AND X<ENDTT, L, 1 ));
dtST =endtT-starttT;
aST = (endST-startST)/dtST;bST = endST;
tHT = aST * ( x -endtT ) + bST;
tH1T=IIf(X>STARTTT-30,tHT,-1E10);
Plot(tH1T,"",bc1,1);
}
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|