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

RE: [amibroker] Does your eSignal data match your QP2 data???



PureBytes Links

Trading Reference Links




I tried to duplicate the LinRegIntercept( ARRAY, periods ) 
example from the 4.50 users guide.I used as example the 
C1=MA(RSI(50),200).The error was calculated from 
Cum(abs(y-C1)).
 
C1=MA(RSI(50),200);Plot(C1,"C1",1,1); x = Cum(1);lastx 
= LastValue( x ); Daysback = LASTX-ValueWhen(Cum(IsTrue(C1))==1,X); aa = 
LastValue( LinRegIntercept( C1, Daysback) );bb = LastValue( LinRegSlope( C1, 
Daysback ) );y = Aa + bb * ( x - (Lastx - DaysBack) ); Plot( IIf( x 
>= (lastx - Daysback), y, -1e10 ), "LinReg", colorRed,8 ); 
Title=Name()+"\nLine="+WriteVal(aa,1.1)+"+"+WriteVal(bb,1.3)+"*(t-t1)"+"\nError="+WriteVal(Cum(abs(y-C1)),1.0);start=Cum(IsTrue(C1))==1;PlotShapes(shapeUpTriangle*start,colorWhite);
 
My analytic 
codet=Cum(1)-1;tmax=LastValue(t);C1=MA(RSI(50),200);Plot(C1,"C1",1,1);C1max=1.5*LastValue(ceil(Highest(C1)));C1min=0.5*LastValue(floor(Lowest(C1)));start=Cum(IsTrue(C1))==1;t1=ValueWhen(start,t);PlotShapes(shapeUpTriangle*start,colorWhite);C10=ValueWhen(start,C1);d0=Param("d0",-0.03,-0.03,-0.005,0.005);Line0=C10+d0*(t-t1);d1=-d0;Line1=C10+d1*(t-t1);Error0=LastValue(Cum(abs(C1-Line0)));Error1=LastValue(Cum(abs(C1-Line1)));Err=Max(Error0,Error1);Title=Name()+"\nInitial 
Error="+WriteVal(err,1.0);stepi=0.1;stepj=0.001;j1=d1;j0=d0;for(i=C1min;i<=C1max;i=i+stepi){for(j=j0;j<=j1;j=j+stepj){Line=i+j*(t-t1);err1=LastValue(Cum(abs(C1-Line)));if(err1<err)err=Min(err,err1);}}Title=Title+"\nMinError="+WriteVal(err,1.0);iA=0;jA=0;for(i=C1min;i<=C1max;i=i+stepi){for(j=j0;j<=j1;j=j+stepj){Line=i+j*(t-t1);err1=LastValue(Cum(abs(C1-Line)));if(err1==err){Plot(Line,"\n"+WriteVal(j,1.4),colorRed,8);Title=Title+"\n\nLine="+WriteVal(i,1.1)+"+"+WriteVal(j,1.3)+"*(t-t1)";iA=i;jA=j;}}}Title=Title+"\nFirst 
Approx [iA,jA]=["+WriteVal(iA,1.1)+","+WriteVal(jA,1.3)+"]";
 
gave, in many cases, smaller error.Is there any 
explanation ?Dimitris Tsokakis
 
 


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








Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.







Attachment:
1error.gif

Attachment: Description: "Description: GIF image"