StochasticRSI indicator. Not StochRSI

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

StochasticRSI indicator. Not StochRSI

Postby TomTrader » Mon Sep 20, 2010 12:26 pm

Did anyone develop or know how to develop StochasticRSI (%D and %K) it displays 2 lines (max value is 1, min value is 0)? need it in C++ or NinjaScript

StochasticRSI as defined in Ameritrade:

This oscillator measures the value of RSI relative to its highest high and lowest low over %K Length periods. StochasticRSI %D is a moving average of %K over %D Length bars. %K smoothing parameter specifies the length of moving average to smooth %K line. StochasticRSI ranges from 0 (lowest low) to 1 (highest high).

Fields:
• StocK, StocD
• RSI Length
• %K Length
• %D Length
• %K Smoothing
• Interval

Example:
StochasticRSI[StocK,14,14,3,1,5]
14-period StochasticRSI on 5-minute bars

I appreciate your help
Tom
TomTrader
 
Posts: 2
Joined: Mon Sep 20, 2010 12:20 pm

Re: StochasticRSI indicator. Not StochRSI

Postby Nikolay.Gekht » Mon Sep 20, 2010 1:24 pm

Hm... I read the description carefully, but I cannot see a big difference with StochRSI indicator. The only difference is that Ameritrade does not slow %K line at all, while StochRSI let you do it. Just specify KS=1 for StochRSI and it will be exactly as it's described.

So, as far as I can see, port of StochRSI to C++ or any other language must be enough.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: StochasticRSI indicator. Not StochRSI

Postby TomTrader » Mon Sep 20, 2010 1:31 pm

StochRSI only displays one line and it goes from 0-80, how do I convert it to the way it's displayed on TDA StrategyDesk with values between 0-1and both %K and %D lines?
TomTrader
 
Posts: 2
Joined: Mon Sep 20, 2010 12:20 pm

Re: StochasticRSI indicator. Not StochRSI

Postby Nikolay.Gekht » Tue Sep 21, 2010 1:07 pm

Ouch...

It seems like you have to look at the indicator carefully first ;)

stochrsi.png
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: StochasticRSI indicator. Not StochRSI

Postby Nikolay.Gekht » Tue Sep 21, 2010 1:11 pm

However, convert it into two solid lines and 0-1 range (both is a question of taste, to tell trught, five hundreds StochRSI users like it as is) is pretty easy:

1) Replace the following lines:
SK:addLevel(20);
SK:addLevel(50);
SK:addLevel(80);

with
SK:addLevel(0.2);
SK:addLevel(0.5);
SK:addLevel(0.8);

to fix levels

2) Replace the following line:
SD = instance:addStream("D", core.Dot, name .. ".D", "D", instance.parameters.D_color, firstD);
with
SD = instance:addStream("D", core.Line, name .. ".D", "D", instance.parameters.D_color, firstD);
To draw %D line as a solid line

3) And, finally, the following lines
if (min == max) then
SKI[period] = 100;
else
SKI[period] = (RSI.DATA[period] - min) / (max - min) * 100;
end

with
if (min == max) then
SKI[period] = 1;
else
SKI[period] = (RSI.DATA[period] - min) / (max - min);
end

to remove adjustment of 0..1 range to 0.100% range

I highlight that part of code which is actually changed using italic. Not so much to do. :roll:
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 31 guests