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

Re: [amibroker] Running AB from the command line



PureBytes Links

Trading Reference Links




Dimitri,
I have always some doubt about the usage of 
lastvalue in afl code
lastvalue returns the array value of [barcount-1] 
along all the bars, so somewhere I ask me if it looks in the 
future?
the c++ code does not use lastvalue, of course the 
sinusoid are differents , but I don't know which one is more 
accurate
attached the two chart on DJI, white ( the dll), 
blue the afl for the first // Fundamental period, 
crude approximation
 
 

 
// Elementary Fourier analysis, by D. Tsokakis, May 2004<FONT 
size=1>
t=Cum(<FONT 
color=#ff00ff size=1>1)-<FONT color=#ff00ff 
size=1>1;
C1=MA(<FONT 
color=#0000ff size=1>RSI(<FONT color=#ff00ff 
size=1>50),100<FONT 
size=1>);
start=Cum(<FONT 
color=#0000ff size=1>IsTrue(C1))==<FONT color=#ff00ff 
size=1>1;
t1=ValueWhen<FONT 
size=1>(start,t);
PlotShapes<FONT 
color=#000000>(shapeDownTriangle*start,colorYellow);
C10=ValueWhen<FONT 
size=1>(start,C1);Plot<FONT 
size=1>(C1,"C1"<FONT 
size=1>,colorBlack,8<FONT 
size=1>);
GraphXSpace=2;
x = Cum(<FONT 
color=#ff00ff size=1>1);
lastx = LastValue( x ); 

Daysback = LastValue<FONT 
size=1>(Cum(<FONT 
color=#0000ff size=1>IsTrue(C1)));
aa = LastValue( 
LinRegIntercept( C1, 
Daysback) );
bb = LastValue( 
LinRegSlope( C1, Daysback 
) );
yy = Aa + bb * ( x - (Lastx - DaysBack) ); 
yy=IIf( x >= (lastx 
- Daysback), yy, -1e10 
);
Plot( yy, <FONT color=#ff00ff 
size=1>"yy", colorRed ); 

detrend=C1-yy;
new1=detrend;
Hor=LastValue<FONT 
size=1>(Cum<FONT 
size=1>(new1)/Cum<FONT 
size=1>(IsTrue(C1)));
pi=4*<FONT 
color=#0000ff size=1>atan(<FONT color=#ff00ff 
size=1>1);n=12<FONT 
size=1>;
// Fundamental period, crude approximation
error00=10000<FONT 
size=1>;per01=0<FONT 
size=1>;g01=0<FONT 
size=1>;phi01=0<FONT 
size=1>;stg0=0.5<FONT 
size=1>;stp0=100<FONT 
size=1>;
for(phi=<FONT color=#ff00ff 
size=1>0;phi<<FONT color=#ff00ff 
size=1>2*pi;phi=phi+pi/n)
{
for(g=<FONT color=#ff00ff 
size=1>0.5;g<=<FONT color=#ff00ff 
size=1>8;g=g+stg0)
{
for(per=<FONT color=#ff00ff 
size=1>300;per<=<FONT color=#ff00ff 
size=1>1000;per=per+stp0)
{f=1/per;
y=Hor+g*sin<FONT 
size=1>(2<FONT 
size=1>*pi*f*(t-t1)+phi);
error=LastValue<FONT 
size=1>(Cum(<FONT 
color=#0000ff size=1>abs(y-new1)));<FONT 
color=#800000 size=1>
if(error<error00)
{error00=error;per01=per;g01=g;phi01=phi;}
}}}
f01=1/per01;
y01=Hor+g01*sin<FONT 
size=1>(2<FONT 
size=1>*pi*f01*(t-t1)+phi01);
Plot(y01+yy,<FONT color=#ff00ff 
size=1>"y01",colorBlue,<FONT 
color=#ff00ff size=1>1<FONT 
color=#000000>|styleThick);
/*<FONT 
color=#000000>
you can plot the dll for this first <FONT 
face="Times New Roman" size=1>Elementary Fourier analysis with
sft=dtFFT(C1,detrend,t1);<FONT 
color=#0000ff>
Plot(yy +sft,"sft",colorWhite,<FONT 
color=#ff00ff>1|styleThick);
*/
 
<FONT color=#008000 
size=1>
<FONT 
size=1>
 


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 Sponsor


  ADVERTISEMENT 












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:
Capture1.jpg
Description: JPEG image
Attachment:

Attachment: Description: "Description: application/msdownload"

Attachment: Description: "Test.dll"