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

[amibroker] Need help with formula calculation


  • Date: Mon, 15 Mar 2010 07:31:29 -0700 (PDT)
  • From: James <jamesmemphis@xxxxxxxxx>
  • Subject: [amibroker] Need help with formula calculation

PureBytes Links

Trading Reference Links



Hello,
 
Following is some slightly modified code originally introduced by D. Tsokakis. I obviously do not understand how the formula calculates x1. 
 
It seems to me that when k1 or k2 = 0, then t1 will equal t. This is because coeff*k1 or coeff*k2 would equal 0. If t = t1 then x would equal x1, and the two graphs should be equal at this point. However, this is clearly not what is going on when you look at this on a chart. Can someone tell me what I am missing here?
 
Best regards,
James Karn
 
/*TREND DETECTOR WITH VARIABLE PERIOD, by D. Tsokakis, Apr2003*/
t=
20;

x=
DEMA(StochD(40
),t);
Plot(x,"",1,8);

Cond1=Ref(x,-1)==LLV(x,3);
Plot(50*Cond1,"",5,2);

Cond2=
Ref(x,-1)==HHV(x,3
);
Plot(50*Cond2,"",4,2);

k1=
BarsSince(Cond1);

k2=
BarsSince(Cond2);

Plot((k2>k1)*10,"",5,2
);
Plot((k2<k1)*10,"",4,2
);
t1=
IIf(k2>k1,t+coeff*k1,t+coeff*k2);// if k1 or k2 = 0, then t1 = t ?

x1=
DEMA(StochD(40),t1);// if t1 = t, then x1 = x ?

Plot(x1,"",(x1>Ref(x1,-1))*5+(x1<Ref(x1,-1))*4,8
);
GraphXSpace=1
;

"x: " + NumToStr( x, 1.4
);
"k1: " + NumToStr( k1, 1.0
);
"k2: " + NumToStr( k2, 1.0
);
"t1: " + NumToStr( t1, 1.0
);
"x1: " + NumToStr( x1, 1.4
);




__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___