트레이딩뷰 지표수식 변환 요청드립니다.
##
// RSI Past
//@version=5
indicator(title="RSI Past", shorttitle="RSI Past", overlay=false, precision=0)
// RSI input settings
rsiLength = input.int(14, title="Length", minval=2, group="RSI Settings")
rsiSource = input(close, title="Price", group="RSI Settings")
rsiOverbought = input.float(70, title="Overbought Threshold", group="RSI Settings")
rsiOversold = input.float(30, title="Oversold Threshold", group="RSI Settings")
// RSI input colors
color aboveColor = input.color(color.green, "Above 0 Color", group="Color Settings")
color belowColor = input.color(color.red, "Below 0 Color", group="Color Settings")
color zeroColor = input.color(color.black, "Zero Line Color", group="Color Settings")
var color plotColor = zeroColor
var int lastBullish = na
var int lastBearish = na
var float reading = na
rsiValue = ta.rsi(rsiSource, rsiLength)
if rsiValue < rsiOversold
lastBearish := bar_index
else if rsiValue > rsiOverbought
lastBullish := bar_index
if lastBullish and lastBearish
reading := lastBullish - lastBearish
if reading
if reading > 0
plotColor := aboveColor
else if reading < 0
plotColor := belowColor
else
plotColor := zeroColor
readingPlot = plot(reading, title="RSI Pass", color=plotColor, style=plot.style_area, linewidth=3)
답변 1
예스스탁
예스스탁 답변
2022-12-20 14:15:24
안녕하세요
예스스탁입니다.
input : rsiLength(14),rsiOverbought(70),rsiOversold(30);
var : rsiValue(0), plotColor(0),lastBearish(0),lastBullish(0),reading(0);
rsiValue = rsi(rsiLength);
if rsiValue < rsiOversold Then
lastBearish = Index;
if rsiValue > rsiOverbought Then
lastBullish = Index;
if lastBullish > 0 and lastBearish > 0 Then
reading = lastBullish - lastBearish;
if reading > 0 Then
plotColor = green;
Else if reading < 0 Then
plotColor = red;
else
plotColor = black;
plot1(reading,"RSI Pass", plotColor);
즐거운 하루되세요
> 당일선물 님이 쓴 글입니다.
> 제목 : 지표수식 변환 요청드립니다
> 트레이딩뷰 지표수식 변환 요청드립니다.
##
// RSI Past
//@version=5
indicator(title="RSI Past", shorttitle="RSI Past", overlay=false, precision=0)
// RSI input settings
rsiLength = input.int(14, title="Length", minval=2, group="RSI Settings")
rsiSource = input(close, title="Price", group="RSI Settings")
rsiOverbought = input.float(70, title="Overbought Threshold", group="RSI Settings")
rsiOversold = input.float(30, title="Oversold Threshold", group="RSI Settings")
// RSI input colors
color aboveColor = input.color(color.green, "Above 0 Color", group="Color Settings")
color belowColor = input.color(color.red, "Below 0 Color", group="Color Settings")
color zeroColor = input.color(color.black, "Zero Line Color", group="Color Settings")
var color plotColor = zeroColor
var int lastBullish = na
var int lastBearish = na
var float reading = na
rsiValue = ta.rsi(rsiSource, rsiLength)
if rsiValue < rsiOversold
lastBearish := bar_index
else if rsiValue > rsiOverbought
lastBullish := bar_index
if lastBullish and lastBearish
reading := lastBullish - lastBearish
if reading
if reading > 0
plotColor := aboveColor
else if reading < 0
plotColor := belowColor
else
plotColor := zeroColor
readingPlot = plot(reading, title="RSI Pass", color=plotColor, style=plot.style_area, linewidth=3)