예스스탁
예스스탁 답변
2025-05-21 10:26:00
안녕하세요
예스스탁입니다.
input : shortLength(10),middleLength(30),longLength(50);
var : src(0),p(0),ov(0),s(0),i(0),ord(0),ii(0),d(0);
var : rci1(0),rci2(0),rci3(0);
src = close;
d = 0;
For i = 0 to shortLength - 1
{
p = src[i];
ov = 1;
s = 0;
for ii = 0 to shortLength - 1
{
if p < src[ii] Then
{
ov = ov + 1;
}
else
{
if p == src[ii] Then
s = s + 1;
}
}
ord = ov + (s - 1) / 2.0;
d = d + pow((i + 1) - ord, 2);
}
rci1 = (1.0 - 6.0 * d / (shortLength * (shortLength * shortLength - 1.0))) * 100.0;
d = 0;
For i = 0 to middleLength - 1
{
p = src[i];
ov = 1;
s = 0;
for ii = 0 to middleLength - 1
{
if p < src[ii] Then
{
ov = ov + 1;
}
else
{
if p == src[ii] Then
s = s + 1;
}
}
ord = ov + (s - 1) / 2.0;
d = d + pow((i + 1) - ord, 2);
}
rci2 = (1.0 - 6.0 * d / (middleLength * (middleLength * middleLength - 1.0))) * 100.0;
d = 0;
For i = 0 to longLength - 1
{
p = src[i];
ov = 1;
s = 0;
for ii = 0 to longLength - 1
{
if p < src[ii] Then
{
ov = ov + 1;
}
else
{
if p == src[ii] Then
s = s + 1;
}
}
ord = ov + (s - 1) / 2.0;
d = d + pow((i + 1) - ord, 2);
}
rci3 = (1.0 - 6.0 * d / (longLength * (longLength * longLength - 1.0))) * 100.0;
plot1(rci1, "RCI1",Blue);
plot2(rci2, "RCI2",Red);
plot3(rci3, "RCI3",Green);
PlotBaseLine1(0, "Middle band");
PlotBaseLine2(80, "Upper band");
PlotBaseLine3(-80, "Lower band");
즐거운 하루되세요
> 삼손감자 님이 쓴 글입니다.
> 제목 : 지표 변환 부탁드립니다.
> //@version=6
indicator("RCI Ribbon", "RCI Ribbon", precision = 2, timeframe = "", timeframe_gaps = true)
source = input.source(close, title = "Source")
shortLength = input.int(10, title = "Short RCI Length", minval = 1)
middleLength = input.int(30, title = "Middle RCI Length", minval = 1)
longLength = input.int(50, title = "Long RCI Length", minval = 1)
plot(ta.rci(source, shortLength), title = "Short RCI", color = color.blue)
plot(ta.rci(source, middleLength), title = "Middle RCI", color = color.red)
plot(ta.rci(source, longLength), title = "Long RCI", color = color.green)
hline(0, "Middle band")
upper = hline(80, "Upper band")
lower = hline(-80, "Lower band")
fill(upper, lower, color.new(color.blue, 90))