Stochastic
This examples shows plotting Stochastic in a sub-window using a Bar count of
7 and 3 for both averages. The examples plots the raw stochastic,
and %K Slow and %D slow.
procedure Stochastic;
var
i,j,study,nBar,nAve1,nAve2,barindex: integer;
HighestHigh,LowestLow,Stochas: real;
begin
if BarBegin<>BarEnd then begin {initialize
parameters}
SetUser(eParm1,7);
SetUser(eParm2,3);
SetUser(eParm3,3);
end; nBar:=GetUser(eParm1);
nAve1:=GetUser(eParm2);
nAve2:=GetUser(eParm3);
SetUser(ePlot1,True); SetUser(eShow1,True);
SetUser(ePlot2,True); SetUser(eShow2,True);
SetUser(ePlot3,True); SetUser(eShow3,True);
SetUser(eWindow,1); {plot
in 1st study window}
Study:=FindStudy(eESPL); for i:=BarLeft to BarEnd do
begin
HighestHigh:=Highest(eHigh,i,nBar,barindex,1,0);
LowestLow:=Lowest(eLow,i,nBar,barindex,1,0);
Stochas:=100*(Last(i)-LowestLow)/(HighestHigh-LowestLow);
Plot(1,Stochas,i);
{plot raw}
Plot(2,Average(1,i,nAve1,Study),i); {plot
%K slow}
Plot(3,Average(2,i,nAve2,Study),i); {plot
%D slow}
end;
end;
{----- MAIN PROGRAM -----}
begin
if ESPL=51 then Stochastic;
end;
|