PureBytes Links
Trading Reference Links
|
Dear Tomasz,
I am trying my first attempt at using scripting and felt I needed to
because of my need to iterate through this array. Can you determine why
this is causing me VBScript error messages? I know scripting is slower but
unless you tell me otherwise, I don't think what I want to do is allowed in
current version of AFL.
Thanks,
Dave Beaudoin
***********************
EnableScript("VBScript");
EWAP=(high + low)/2;
EWOsc=( ma( EWAP, 5 ) - ma( EWAP, 35 ));
length=80;
trigger=0.70;
EWOscpeak=hhv( EWOsc, length );
EWOsctrough=llv( EWOsc, length );
<%
EWOsc = AFL("EWOsc")
EWOscpeak = AFL("EWOscpeak")
EWOsctrough = AFL("EWOsctrough")
length = AFL("length")
trigger = AFL("trigger")
' this variable specifies the trend determined by EWOsc
Trend ( 0 ) = 0
' iterate along the array
for i = 0 to UBound( EWOsc )
' Set initial Trend at zero and look for up trend
if( EWOsc( i ) = EWOscpeak ( i ) ) AND Trend=0 then
Trend( i ) = 1
end if
' Set initial Trend at zero and look for down trend
if( EWOsc ( i ) = EWOsctrough ( i ) ) AND Trend=0 then
Trend( i ) = -1
end if
' Look for change from downtrend to uptrend
if( EWOsctrough ( i ) < 0 ) AND Trend=-1 AND (EWOsc ( i ) > -1 * trigger *
EWOsctrough ( i ) ) then
Trend( i ) = 1
end if
' Look for change from uptrend to downtrend
if( EWOscpeak ( i ) > 0 ) AND Trend=1 AND (EWOsc ( i ) < -1 * trigger *
EWOscpeak ( i ) ) then
Trend( i ) = 1
end if
next
AFL("Trend") = Trend
%>
graph1=Trend;
title=name() + " Trend" + writeval( graph1 );
|