Login Page - Create Account

Support Board


Date/Time: Tue, 30 Apr 2024 03:43:49 +0000



Looking to replicate StochRSI osc fromMT4 in Sierra

View Count: 1441

[2016-06-29 02:49:27]
User113734 - Posts: 60
Hi,

I am lookign to replicate the following values in sierra chart StochRSI. See here https://gyazo.com/7eaaa4a2b87f14b77bccb881ffc61b07

Unfortunately, Sierra, in its StochRSI study, only allows 'RSI Length' to be changed. See here https://gyazo.com/93fd37906c647cccbfb2d3f5aa2e13ed

Is there a way to add 'Period K' and Slow Period, so that I can replicate the MT4 indicator in Sierra?

Thanks!
[2016-06-29 09:20:02]
Sierra Chart Engineering - Posts: 104368
There is only one additional Length input we can add and this is for computing the highest and lowest of the RSI result over the specified Length. This will be added to the next release.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2016-07-01 00:09:51]
User113734 - Posts: 60
It is my understanding that most Stoch RSI indicators can add K period and slow period... is that something Sierra can deliver in its StochRSI?

If it helps, find below the MT4 code:


#property indicator_separate_window
#property indicator_levelcolor PaleTurquoise
#property indicator_buffers 1
#property indicator_color1 Lime
#property indicator_width1 2
#property indicator_level1 20.0
#property indicator_level2 80.0

extern int RSIPeriod = 8;
extern int PeriodK = 8;
extern int SlowPeriod = 3;
double gda_88[];
double g_ibuf_92[];
double gda_96[];
bool gi_100 = FALSE;
string gs_104;

int init() {
IndicatorBuffers(1);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexBuffer(0, g_ibuf_92);
SetIndexDrawBegin(0, RSIPeriod);
gs_104 = "MT4-StochasticRSI-Oscillator-" + "v1.1" + " (" + RSIPeriod + "," + PeriodK + "," + SlowPeriod + ")";
IndicatorShortName(gs_104);
SetIndexLabel(0, gs_104);
ArraySetAsSeries(gda_88, TRUE);
ArraySetAsSeries(gda_96, TRUE);
Print(gs_104);
Print("Copyright (c) 2007 - Bruce Hellstrom, bhweb@speakeasy.net");
return (0);
}

int deinit() {
return (0);
}

int start() {
double ld_12;
double ld_20;
int li_0 = IndicatorCounted();
if (li_0 < 0) return (-1);
if (li_0 > 0) li_0--;
if (ArraySize(gda_88) != ArraySize(g_ibuf_92)) {
ArraySetAsSeries(gda_88, FALSE);
ArrayResize(gda_88, ArraySize(g_ibuf_92));
ArraySetAsSeries(gda_88, TRUE);
}
if (ArraySize(gda_96) != ArraySize(g_ibuf_92)) {
ArraySetAsSeries(gda_96, FALSE);
ArrayResize(gda_96, ArraySize(g_ibuf_92));
ArraySetAsSeries(gda_96, TRUE);
}
int li_4 = Bars - li_0;
for (int li_8 = 0; li_8 < li_4; li_8++) {
gda_88[li_8] = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, li_8);
if (gi_100)
if (gda_88[li_8] > 100.0) Print("Bar: ", li_8, " RSI: ", gda_88[li_8]);
}
for (li_8 = 0; li_8 < li_4; li_8++) {
ld_12 = LLV(gda_88, PeriodK, li_8);
ld_20 = HHV(gda_88, PeriodK, li_8);
if (ld_20 - ld_12 > 0.0) {
gda_96[li_8] = 100.0 * ((gda_88[li_8] - ld_12) / (ld_20 - ld_12));
if (gi_100 && li_8 < 100)
if (gda_96[li_8] > 100.0) Print("Bar: ", li_8, " TempBuffer: ", gda_96[li_8], " RSI: ", gda_88[li_8], " hhv: ", ld_20, " llv:", ld_12);
}
}
for (li_8 = 0; li_8 < li_4; li_8++) g_ibuf_92[li_8] = iMAOnArray(gda_96, 0, SlowPeriod, 0, MODE_EMA, li_8);
return (0);
}

double LLV(double ada_0[], int ai_4, int ai_8) {
double ld_ret_12 = 0.0;
int li_20 = ai_8;
for (int li_24 = li_20; li_24 < li_20 + ai_4; li_24++) {
if (li_24 == li_20) ld_ret_12 = ada_0[li_24];
ld_ret_12 = MathMin(ld_ret_12, ada_0[li_24]);
}
return (ld_ret_12);
}

double HHV(double ada_0[], int ai_4, int ai_8) {
double ld_ret_12 = 0.0;
int li_20 = ai_8;
for (int li_24 = li_20; li_24 < li_20 + ai_4; li_24++) {
if (li_24 == li_20) ld_ret_12 = ada_0[li_24];
ld_ret_12 = MathMax(ld_ret_12, ada_0[li_24]);
}
return (ld_ret_12);
}
[2016-07-01 05:18:42]
Sierra Chart Engineering - Posts: 104368
We cannot add any further capability to the study at this time.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account