samtsui

Connors RSI Test

148
Re Fade2Black request:

The indicator needs to use Connors RSI on candle stick charts.

It basically needs to give an alert if the candle stick closes even or up but the Conors RSI closes down more than 3 points.

Here's a pic showing..

tinypic.com/r/2j62z5v/9

And on the flip side I also need it to give an alert if the candle closes even or down but the conors rsi close up more than 3 points.

Like this..

tinypic.com/r/imjod4/9

I hope I've explained myself well. Let me know how much you'd charge for this.

Thanks
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//--study(title="Connors RSI")
study("Connors RSI Test", shorttitle = "CRSI Test", overlay=false)

//--------------- input parameters

src = input(defval=close, type=source, title="Source")
lenrsi = input(3, minval=1, type=integer, title="RSI Length")
lenupdown = input(2, minval=1, type=integer, title="UpDown Length")
lenroc = input(100, minval=1, type=integer, title="ROC Length")

//--------------- define function

updown(s) => 
    isEqual = s == s[1]
    isGrowing = s > s[1]
    ud = isEqual ? 0 : isGrowing ? (nz(ud[1]) <= 0 ? 1 : nz(ud[1])+1) : (nz(ud[1]) >= 0 ? -1 : nz(ud[1])-1)
    ud

//--------------- calculate RSIs

rsi = rsi(src, lenrsi)
updownrsi = rsi(updown(src), lenupdown)
percentrank = percentrank(roc(src, 1), lenroc)
crsi = avg(rsi, updownrsi, percentrank)

//--------------- calculate signal

sig1 = (close >= open) and (crsi < (crsi[1] - 3)) ? 1 : na
sig2 = (close <= open) and (crsi > (crsi[1] + 3)) ? 1 : na


//-------------- plotting
plot(crsi, color=blue, linewidth=1, title="Connors RSI")
band1 = hline(70, color=gray, linestyle=dashed)
band2 = hline(30, color=gray, linestyle=dashed)
fill(band1, band2)

plotshape(sig1, style=shape.labeldown, size=size.tiny, location=location.top, color=red)
plotshape(sig2, style=shape.labelup, size=size.tiny, location=location.bottom, color=blue)
//--END