stochastic indicator: what is wrong

Questions about MultiCharts and user contributed studies.
nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

stochastic indicator: what is wrong

Postby nuno-online » 30 Jul 2009

Hi

what is wrong in my code
as you see in the screenshot, for example (symbol LG), i have oSlowK = 37.28 and i have zone = OverBot whereas OverBought=80

here the code

Code: Select all

{ Stochastic Indicator }

Inputs:
PriceH(High), PriceL(Low), PriceC(Close), StochLength(9),
SmoothingLength1(3), { used to slow FastK to FastD = SlowK }
SmoothingLength2(3), { used to slow FastD to SlowD }
SmoothingType(1), { pass in 1 for Original, 2 for Legacy }
OverSold(20), OverBought(80), Width(2);

Variables:
oFastK(0), oFastD(0), oSlowK(0), oSlowD(0), Zone(" "), StoMA(" ");

Value1 = Stochastic( PriceH, PriceL, PriceC, StochLength, SmoothingLength1,
SmoothingLength2, SmoothingType, oFastK, oFastD, oSlowK, oSlowD ) ;

// OverSold & OverBought
If oSlowK <= OverSold then
Begin
Zone = "OverSld";
Plot1(Zone, "Zone", Red);
End
Else if oSlowK >= OverBought then
Begin
Zone = ("OverBot");
Plot1(Zone, "Zone", Green);
End
Else
Zone = "---";

Plot3(oSlowK, "oSlowK",green);
Attachments
stochastic.png
(141.49 KiB) Downloaded 348 times

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Postby nuno-online » 30 Jul 2009

TJ

sorry but i don't understand exactly what you said

User avatar
TJ
Posts: 7238
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Postby TJ » 30 Jul 2009

you need to make a plot at the last ELSE of your IF-THEN-ELSE:

...
Else
begin
Zone = "---";
Plot1(Zone, "Zone", Green);
End;

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Postby nuno-online » 30 Jul 2009

Once again
THANK YOU VERY MUCH for your help TJ

Nuno


Return to “MultiCharts”