RCI3本を使ったインジケーターです。
買われすぎラインを80 売られすぎラインを-80とし、このラインに短期線、中期線、長期戦いずれかが抜けだした時にサインが出現します。
サインに合わせてアラートを鳴らすこともできます。
RCI80OUTインジケーター
コチラがインジケーターを表示させたときの画像。
トレーディングビューの下の段にRCIを3本表示します。
短期線:S
中期線:M
長期戦:L
でサインを表示。サインはそれぞれ表示、非表示切り替えられます。
例えばこの画面のように、短期のサインだけ、中期長期だけなど細かく調整できます。
コチラはパラメータ画面。短期中期長期、買われすぎ売られすぎの数値はそれぞれ設定できます。
ただし、買われすぎ売られすぎのラインを変更したとしても、サインやアラートは±80で固定です。
コチラがスタイル画面。短期中期長期線のラインの色や太さはコチラで変更可能です。
コチラがアラート画面。
短期、中期、長期の買いサイン売りサインに合わせて設定できます。
RCI80OUTインジケーターコード
//@version=5 indicator("RCI 80 OUT", overlay=false, shorttitle="RCI 80 OUT", max_labels_count=500) // Input parameters itvs = input(9, "Short Term RCI Period") itvm = input(26, "Mid Term RCI Period") itvl = input(52, "Long Term RCI Period") upperband = input(80, "Overbought") lowerband = input(-80, "Oversold") exitThreshold = input(50, "Exit Threshold", tooltip="RCI level for exit signals (closer to 0)") showShortSignals = input(true, "Show Short Term Signals") showMidSignals = input(true, "Show Mid Term Signals") showLongSignals = input(true, "Show Long Term Signals") // RCI calculation function d(itv) => sum = 0.0 for i = 0 to itv - 1 o = 1.0 s = 0.0 p = close[i] for j = 0 to itv - 1 if p < close[j] o := o + 1 else if p == close[j] s := s + 1 rank = o + (s - 1) / 2.0 sum := sum + math.pow((i + 1) - rank, 2) sum rci(itv) => (1.0 - 6.0 * d(itv) / (itv * (itv * itv - 1.0))) * 100.0 // Calculate RCI values once rciShort = rci(itvs) rciMid = rci(itvm) rciLong = rci(itvl) // Exit signal calculations - when RCI moves back toward neutral zone // For sell exits: RCI crosses down from overbought toward neutral // For buy exits: RCI crosses up from oversold toward neutral exitSellSignal1 = showShortSignals and rciShort[1] >= upperband and ta.crossunder(rciShort, exitThreshold) exitBuySignal1 = showShortSignals and rciShort[1] <= lowerband and ta.crossover(rciShort, -exitThreshold) exitSellSignal2 = showMidSignals and rciMid[1] >= upperband and ta.crossunder(rciMid, exitThreshold) exitBuySignal2 = showMidSignals and rciMid[1] <= lowerband and ta.crossover(rciMid, -exitThreshold) exitSellSignal3 = showLongSignals and rciLong[1] >= upperband and ta.crossunder(rciLong, exitThreshold) exitBuySignal3 = showLongSignals and rciLong[1] <= lowerband and ta.crossover(rciLong, -exitThreshold) // Alternative: Simple exit when crossing back toward center from extremes altExitSellSignal1 = showShortSignals and ta.crossunder(rciShort, upperband) altExitBuySignal1 = showShortSignals and ta.crossover(rciShort, lowerband) altExitSellSignal2 = showMidSignals and ta.crossunder(rciMid, upperband) altExitBuySignal2 = showMidSignals and ta.crossover(rciMid, lowerband) altExitSellSignal3 = showLongSignals and ta.crossunder(rciLong, upperband) altExitBuySignal3 = showLongSignals and ta.crossover(rciLong, lowerband) // Use alternative exit signals (simpler logic) finalExitSellSignal1 = altExitSellSignal1 finalExitBuySignal1 = altExitBuySignal1 finalExitSellSignal2 = altExitSellSignal2 finalExitBuySignal2 = altExitBuySignal2 finalExitSellSignal3 = altExitSellSignal3 finalExitBuySignal3 = altExitBuySignal3 // Plot RCI lines plot(rciShort, color=color.red, title="Short Term RCI", linewidth=2) plot(rciMid, color=color.green, title="Mid Term RCI", linewidth=2) plot(rciLong, color=color.blue, title="Long Term RCI", linewidth=2) // Plot reference lines hline(upperband, "Overbought", color=color.gray, linestyle=hline.style_dashed) hline(lowerband, "Oversold", color=color.gray, linestyle=hline.style_dashed) hline(exitThreshold, "Exit Threshold", color=color.orange, linestyle=hline.style_dotted) hline(-exitThreshold, "Exit Threshold", color=color.orange, linestyle=hline.style_dotted) hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted) // Exit signal labels with improved positioning if finalExitSellSignal1 or finalExitSellSignal2 or finalExitSellSignal3 labelY = math.max(rciShort, math.max(rciMid, rciLong)) + 10 labelText = "" labelColor = color.red if finalExitSellSignal1 labelText := labelText + "S" labelColor := color.red if finalExitSellSignal2 labelText := labelText + "M" labelColor := finalExitSellSignal1 ? color.orange : color.green if finalExitSellSignal3 labelText := labelText + "L" labelColor := (finalExitSellSignal1 or finalExitSellSignal2) ? color.purple : color.blue label.new(x=bar_index, y=labelY, style=label.style_label_down, color=color.new(labelColor, 20), text="EXIT↓" + labelText, size=size.small, textcolor=color.white) if finalExitBuySignal1 or finalExitBuySignal2 or finalExitBuySignal3 labelY = math.min(rciShort, math.min(rciMid, rciLong)) - 10 labelText = "" labelColor = color.green if finalExitBuySignal1 labelText := labelText + "S" labelColor := color.red if finalExitBuySignal2 labelText := labelText + "M" labelColor := finalExitBuySignal1 ? color.orange : color.green if finalExitBuySignal3 labelText := labelText + "L" labelColor := (finalExitBuySignal1 or finalExitBuySignal2) ? color.purple : color.blue label.new(x=bar_index, y=labelY, style=label.style_label_up, color=color.new(labelColor, 20), text="EXIT↑" + labelText, size=size.small, textcolor=color.white) // Alerts for exit signals alertcondition(finalExitSellSignal1, title="Short Term Sell Exit Alert", message="Short Term RCI exit signal - consider closing long positions!") alertcondition(finalExitBuySignal1, title="Short Term Buy Exit Alert", message="Short Term RCI exit signal - consider closing short positions!") alertcondition(finalExitSellSignal2, title="Mid Term Sell Exit Alert", message="Mid Term RCI exit signal - consider closing long positions!") alertcondition(finalExitBuySignal2, title="Mid Term Buy Exit Alert", message="Mid Term RCI exit signal - consider closing short positions!") alertcondition(finalExitSellSignal3, title="Long Term Sell Exit Alert", message="Long Term RCI exit signal - consider closing long positions!") alertcondition(finalExitBuySignal3, title="Long Term Buy Exit Alert", message="Long Term RCI exit signal - consider closing short positions!") // Combined exit alerts alertcondition(finalExitSellSignal1 or finalExitSellSignal2 or finalExitSellSignal3, title="Any RCI Sell Exit Signal", message="RCI Sell Exit Signal - consider closing long positions!") alertcondition(finalExitBuySignal1 or finalExitBuySignal2 or finalExitBuySignal3, title="Any RCI Buy Exit Signal", message="RCI Buy Exit Signal - consider closing short positions!")
※2025/9 表示修正しました。
コピペで使えるハズです。
コメント
こんにちは!
素晴らしい技術をお持ちですね!
憧れます。
こちらのRCIシグナルインジですが、
内側に切り込んだ時に発生しますが
外側に突き出たタイミングでもシグナルが出るように出来ますでしょうか?
私は突き出た時をExitのタイミングとして利用してます。
EntryよりもExitで悩まれてる人も多いと思うので
ご検討いただけたら幸いです。
それではよろしくお願いします!
遅くなってしまい申し訳ありません スパムコメントだらけでコメントが埋もれてしまっていました。 外側に出た時に反応するインジは https://angou-kasou.com/rci-80-in/ がそうなので確認してみてください。 よろしくお願いいたします。