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

[amibroker] Re: Strange Error: Close value shifts 76 days



PureBytes Links

Trading Reference Links

Dear AB users,

I tried to solve the following problem for almost a week now, but 
Í'm lost. 

When I plot the following formula the Close value is lagging the 
rela Close value for 6 days! The formula is the same as the AMA 
example in the Help manual.

/********************** DEFINE VARIABLES **********************/
FastShort		= 18;//Optimize("FK",18,14,28,2); 	
	
FastTrend		= -8;//Optimize("FT",-8,-10,-6,2);	
	
FastLookback	= 3;//Optimize("LkBckFast",3,2,4,1); 	
Fastlong		= 34;//Optimize("FL",34,32,36,2); 	
	


/********************** CALCULATIONS **********************/
fastVar1 		= 2/(FastShort+1);
fastVar2 		= 2/(FastLong+1);
fastdir		= IIf(Close = Ref(Close,-FastLookback), 
Close+0.001,abs(Close-Ref(Close,-FastLookback)));
fastvol		= IIf(Close = Ref(Close,-FastLookback), 
Close+0.001,Sum(abs(Close-Ref(Close,-1)),FastLookback));
fastER			= fastdir/fastvol;
scFast 		= (fastER*(fastVar1-fastVar2)+fastVar2)^2;


/********************** LONG TERM TREND **********************/
FastMA			= AMA(Close,scfast);


/* ********************* PLOT STATEMENTS **********************/
Plot( FastMA, "FastMA", colorGreen, styleLine );
Plot( Close,"Close",colorYellow,styleLine);


//EXAMPLE AB HELP FILE
/*
Graph0 = EMA( Close, 15 );
fast = 2/(2+1);
slow = 2/(30+1);
dir=abs(Close-Ref(Close,-10));
vol=Sum(abs(Close-Ref(Close,-1)),10);
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2; 
Graph0 = AMA( Close, sc ); 
*/


Does someone know what the problem is?

thanks in advance.

Frans.



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:
 http://docs.yahoo.com/info/terms/