PureBytes Links
Trading Reference Links
|
David
Try this code out for size.
Both are indicators which show off VB Scripting.
Place a Price window on one screen and under it place the momentum
and acceleration indicators below.
Steve
At 04:58 AM 5/31/01 +1000, you wrote:
Thanks Steve, I must be doing
something wrong keep getting errors
could you please include a description on how to use the script
is there something else that should be include with the script eg other
afl
info
Thanks David
ps im a code dummy so use the KISS format pls
EnableScript("vbscript");
<%
close = AFL( "close" )
factor = 0.09
var1=close
SetValue Close
Function SetValue(Close)
for i = 1 to UBound( close )
var1( i )= factor * close( i ) + (1 - factor) * var1( i - 1 )
next
end function
AFL.Var("graph0") = close
AFL.Var("graph1") = var1
%>
WriteVal( graph1 );
EnableScript("vbscript");
<%
Close = AFL( "close" )
rsidw1 = close
rsidw1(0) = 0
rsiup1 = close
rsiup1(0) = 0
RSIFml0 = close
RSIFml0(0) = 0
Kalp0 = Close
Kalp0(0) = 0 ' line 10
Kalp0(1) = 0
Lt=4
alp=2/(Lt+1)
rem Function Calls
Call rsidw()
Call rsiup()
Call RSIFml()
Call Kalp()
rem End of Function Calls
rem ---------------------------- Line 20
Function rsidw()
for i = 1 to Ubound(close)
ROC = Close(i)-Close(i-1)
IF ROC<0 then var1 = ABS(ROC) else var1 = 0
rsidw1(i) = ( (rsidw1(i-1) *(Lt-1) ) + var1 ) / Lt
next
End Function
rem ----------------------------
Function rsiup()
for i = 1 to Ubound(close) ' line 30
ROC = Close(i) - Close(i-1)
IF ROC > 0 then var2 = abs(ROC) else var2 = 0
rsiup1(i) = ( (rsiup1(i-1) *(Lt-1) ) + var2 ) / Lt
next
End Function
rem ----------------------------
Function RSIFml()
for i = 3 to Ubound(close )
RSIFml0(i)=(100 * (rsiup1(i)-rsidw1(i) ) / (rsiup1(i) + rsidw1(i) ) )
next ' line 40
End Function
rem-----------------------------
Function Kalp()
for i = 2 to UBound(close )
Kalp0(i) = ((alp^2)*RSIFml0(i) ) + (2*(1-alp) * Kalp0(i-1) - ( ( (1-alp)^2) * Kalp0(i-2) ) )
next
End Function
rem ----------------------------
' line 50
AFL.Var("graph1") = Kalp0
%>
var1 = graph1;
var2 = ema(var1,5);
var3 = var1 - var2;
graph1 = var3;
graph1Style = 6;
graph2=ema(var3,8);
graph2style=5;
graph2color=5;
EnableScript("vbscript");
<%
Close = AFL( "close" )
rsidw1 = close
rsidw1(0) = 0
rsiup1 = close
rsiup1(0) = 0
RSIFml0 = close
RSIFml0(0) = 0
Kalp0 = Close
Kalp0(0) = 0 ' line 10
Kalp0(1) = 0
Lt=4
alp=2/(Lt+1)
rem Function Calls
Call rsidw()
Call rsiup()
Call RSIFml()
Call Kalp()
rem End of Function Calls
rem ---------------------------- Line 20
Function rsidw()
for i = 1 to Ubound(close)
ROC = Close(i)-Close(i-1)
IF ROC<0 then var1 = ABS(ROC) else var1 = 0
rsidw1(i) = ( (rsidw1(i-1) *(Lt-1) ) + var1 ) / Lt
next
End Function
rem ----------------------------
Function rsiup()
for i = 1 to Ubound(close) ' line 30
ROC = Close(i) - Close(i-1)
IF ROC > 0 then var2 = abs(ROC) else var2 = 0
rsiup1(i) = ( (rsiup1(i-1) *(Lt-1) ) + var2 ) / Lt
next
End Function
rem ----------------------------
Function RSIFml()
for i = 3 to Ubound(close )
RSIFml0(i)=(100 * (rsiup1(i)-rsidw1(i) ) / (rsiup1(i) + rsidw1(i) ) )
next ' line 40
End Function
rem-----------------------------
Function Kalp()
for i = 2 to UBound(close )
Kalp0(i) = ((alp^2)*RSIFml0(i) ) + (2*(1-alp) * Kalp0(i-1) - ( ( (1-alp)^2) * Kalp0(i-2) ) )
next
End Function
rem ----------------------------
rem AFL.Var("graph0") = close ' line 50
AFL.Var("graph1") = Kalp0
%>
WriteVal( graph1 );
graph1Style = 6;
graph0=0;
graph2=ema(graph1,8);
graph2style=5;
graph2color=5;
<<< text/plain; charset="us-ascii"; format=flowed: Unrecognized >>>
|