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

[amibroker] Fw: valuewhen



PureBytes Links

Trading Reference Links

 
----- Original Message -----
From: teksöz
Sent: Tuesday, July 19, 2005 7:22 PM
Subject: valuewhen

hi..
I can't understant valuewhen funcion..
please can you translate to matastok code to ami..
thanks..
uğur teksöz
 
1-
{Hourly MACD - Close}
  D:=Input("Signal periods (Hours)",1,19,9);
Q:=Input("1=Dynamic last bar,  2=Sample only @ end of hour",1,2,1);
 {1=dynamic last hour, MS compatible}
 {2=sample end of hour when available}
A:=Minute()=0;
B:=Hour()<>ValueWhen(2,1,Hour()) OR DayOfWeek()<>ValueWhen(2,1,DayOfWeek());
F:=LastValue(Cum(1))=Cum(1);
X:=0.15; Y:=0.075; D:=2/(D+1);
J:=If(A,1,If(Alert(A,2)=0 AND B,2,0));
J:=If(F AND J=0 AND Q=1,1,J);
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
M:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
N:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
R:=M-N;
Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-D)+R*D);
R; {MACD} Z; {signal}
 
 
 
2.
lookback:=Input("....",1,100,10);
Resistance:=ValueWhen(1,Cross(Mov(C,lookback,S),C),HHV(H,lookback));
support:=ValueWhen(1,Cross(Mov(C,lookback,S),C),LLV(L,lookback));
Resistance;
support;


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS