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

[RT] Adaptive stochastic function



PureBytes Links

Trading Reference Links


This is a repaired version of the function 
with an added feature.
 
A smoothing mode of 4 has been added which 
allows the smoothing
to also be a function of the HilbertPeriod 
in a fashion similar
to the length in the computation of the 
Stochastic.
 
The included XAverage2 function allows 
length to change on each
bar if needed.
 
Clyde
 
 
 
 
<FONT face="Courier New" 
size=2>{********************************************************************************TRADESTATION 
CODE FOR ADAPTIVE STOCHASTIC OSCILLATOR(c) 2K Tushar Chande; Adaptive 
Stochastic Oscillator 
 
Function:  
Adaptive_StochasticReturn:    Smoothed (if LengSmo>0) 
value for Stochastic 
based           on a 
length determined internally. History: 6/20/01 - changed 
how adaptive length is calculated.(John Hall) 6/27/01 - CL: Added 
smoothing mode Avg, XAvg, T3Avg, 
XAvg(adapt)           CL: 
Added option to compute Williams 
%R *********************************************************************************} Inputs: 
Price(numericseries),      {Price value to use in 
computation    }         
ALengMul(numeric),         {Multiplier 
for auto length determined}        
LengSmo(numeric),          {Length 
for smoothing operation       
}                                   
{For 4 below is multiplier of Hilbert 
}                                   
{period length computed for sto leng  
}        
SMode(Numeric),            
{1=Avg, 2=XAvg, 3=T3Avg, 4=XAvgAdapt  
}        
MakeWmPR(truefalse);       {Make output Williams % 
R computation }
 
vars: currlen(9), hh(0), ll(0), stoch(0), 
stochma(0) ; 
 
{--- Calculate current effective length 
---}  currlen = 
IntPortion(ALengMul*HilbertPeriod(Price)); {--- Calculate 
stochastic oscillator and its 3-day exponential average 
---}  hh = highest(price, currlen) ; ll = 
lowest(price, currlen) ;
 
 if (hh-ll) > 0    
then stoch = ((price - ll)/(hh - ll)) * 100    else stoch = 
50;
 
 if currentbar = 1 or LengSmo<=0 
then Stochma = stoch    else If SMode<2 then 
StochMa=Average(Stoch,LengSmo)   else If SMode=2 then 
StochMa=XAverage2(Stoch,LengSmo)   else If SMode=3 then 
StochMa=T3Average(Stoch,LengSmo)   else If SMode>3 then 
StochMa=XAverage2(Stoch,LengSmo*currlen);
 
 if MakeWmPR then 
StochMa=100-StochMa;
 
Adaptive_Stochastic = 
StochMa;
- - - - - - - - - - - - - - - - - - - - 
-  - - - - - - -Clyde Lee   
Chairman/CEO          (Home of 
SwingMachine)SYTECH 
Corporation          email: <A 
href="mailto:clydelee@xxxxxxxxxxxx";>clydelee@xxxxxxxxxxxx  7910 
Westglen, Suite 105       
Office:    (713) 783-9540Houston,  TX  
77063               
Fax:    (713) 783-1092Details 
at:                      
www.theswingmachine.com- - - - 
- - - - - - - - - - - - - - - -  - - - - - - - 
-



To unsubscribe from this group, send an email to:
realtraders-unsubscribe@xxxxxxxxxxxxxxx





Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment: Description: "junk1.gif"

Attachment: Description: "adapstof.ela"