트렌드 바이 셀 신호임
작성자 정보
- 물린코인 작성
- 작성일
컨텐츠 정보
- 1,997 조회
- 228 추천
- 98 비추천
- 목록
본문
study("Trend buy sell", overlay=true)
src=close
sm =input(7, title="Smoothing Period")
cd = input(0.4, title="Constant D")
ebc=input(false, title="Color Bars")
ribm=input(false, title="Ribbon Mode")
//===
len = input(14, minval=1, title="Length for Stochastic")
smoothK = input(3, minval=1, title="SmoothK for Stochastic")
smoothD = input(3, minval=1, title="SmoothD for Stochastic")
upLine = input(80, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(20, minval=10, maxval=50, title="Lower Line Value?")
//Not Necessary, In Inputs Tab, capability to turn On/Off Highlight Bars, and Both Crosses
//These are all checkboxes in inputs tab....Show Barcolor Highlights, Show Background Hghlight, Plot B and S for Buy Sell
sbh = input(false, title="Show Background highlight When Stoch is Above/Below High/Low Lines?")
sch = input(false, title="Show Back Ground Highlights When Stoch Cross - Strict Criteria - K Greater/LesThan High/Low Line - Crosses D ?")
sl = input(true, title="Show 'BUY' and 'SELL' Letters When Stoch Crosses High/Low Line & D?")
sac = input(false, title="Show Back Ground Highlights When Stoch Cross - Any Cross?")
sacl = input(false, title="Show 'BUY' and 'SELL' Letters When Stoch Crosses - Any Cross?")
//===
di = (sm - 1.0) / 2.0 + 1.0
c1 = 2 / (di + 1.0)
c2 = 1 - c1
c3 = 3.0 * (cd * cd + cd * cd * cd)
c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
i1 = c1*src + c2*nz(i1[1])
i2 = c1*i1 + c2*nz(i2[1])
i3 = c1*i2 + c2*nz(i3[1])
i4 = c1*i3 + c2*nz(i4[1])
i5 = c1*i4 + c2*nz(i5[1])
i6 = c1*i5 + c2*nz(i6[1])
//corridor
p = input(4,type=integer,title="Length")
hot = input(0.4,title="Coefficient")
shift = input(0,title="Shifted Periods")
e1 = ema(close,p)
e2 = ema(e1,p)
e3 = ema(e2,p)
e4 = ema(e3,p)
e5 = ema(e4,p)
e6 = ema(e5,p)
b2 = hot*hot
b3 = hot*hot*hot
cc1 = -b3
cc2 = 3*b2+3*b3
cc3 = -6*b2-3*hot-3*b3
cc4 = 1+3*hot+b3+3*b2
ret = cc1*e6+cc2*e5+cc3*e4+cc4*e3
he1 = ema(high,p)
he2 = ema(he1,p)
he3 = ema(he2,p)
he4 = ema(he3,p)
he5 = ema(he4,p)
he6 = ema(he5,p)
hret = cc1*he6+cc2*he5+cc3*he4+cc4*he3
le1 = ema(low,p)
le2 = ema(le1,p)
le3 = ema(le2,p)
le4 = ema(le3,p)
le5 = ema(le4,p)
le6 = ema(le5,p)
lret = cc1*le6+cc2*le5+cc3*le4+cc4*le3
//==
//Necessary for Highlight Bars
//Stoch formula
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)
//Necessary for Highlight Bars
//aboveline = OverBought, belowline = Oversold Definitions
aboveLine = k > upLine ? 1 : 0
belowLine = k < lowLine ? 1 : 0
//Only Necessary if you want you want Stochastic Croses
//Definition for Cross when Above High-Low lines
crossUp = (k[1] < d[1] and k[1] < lowLine[1]) and (k > d) ? 1 : 0
crossDn = (k[1] > d[1] and k[1] > upLine[1]) and (k < d) ? 1 : 0
//Only Necessary if you want you want Stochastic Croses
//Definition for Cross that doesn't have to be above or below High and Low line.
crossUpAll = (k[1] < d[1] and k > d) ? 1 : 0
crossDownAll = (k[1] > d[1] and k < d) ? 1 : 0
//==
bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3)
// --------------------------------------------------------------------------
// For the Pinescript coders: Determining trend based on the mintick step.
// --------------------------------------------------------------------------
bfrC = bfr > nz(bfr[1]) ? green : bfr < nz(bfr[1]) ? red : blue
tc=ebc?gray:bfrC
plot(ribm?na:bfr, title="Trend", linewidth=4, style=circles, color=tc)
bgcolor(ribm?bfrC:na, transp=0)
barcolor(ebc?bfrC:na)
KDbuy=bfr > nz(bfr[1])
KDsell= bfr < nz(bfr[1])
//last_signal= 0
long_final = KDbuy and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == -1)
short_final = KDsell and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 1)
alertcondition(long_final, title="BUY ALARM", message="Coral Trend Buy Alarm!!!")
alertcondition(short_final, title="SELL ALARM", message="Coral Trend Sell Alarm!!!")
last_signal= long_final ? 1 : short_final ? -1 : last_signal[1]
plotshape(long_final, color=green, style=shape.arrowup,text="Buy off",title="Buy Label")
plotshape(short_final, color=red, style=shape.arrowdown,location=location.belowbar,text="Sell off", title ="Sell Label")
//plot corridor
p1 = plot(ret,offset=shift,title="Coral T3")
p2 = plot(hret,title="Coral T3 High")
p3 = plot(lret,title="Coral T3 Low")
fill(p1,p2,color=aqua)
fill(p1,p3,color=navy)
//===
//Only Necessary if you want background Highlighting also - Take out the sbh/sbc and part
//BackGround Highlights based on Above/Below Lines, Strict Cross Up/Down
//BackGroound Color Plots
bgcolor(sbh and aboveLine ? red : na, transp=70)
bgcolor(sbh and belowLine ? lime : na, transp=70)
bgcolor(sch and crossUp ? lime : na, transp=40)
bgcolor(sch and crossDn ? red : na, transp=40)
//Only Necessary if you want background Highlighting also
//plots bgcolor Cross with no filter
bgcolor(sac and crossUpAll ? lime : na, transp=40)
bgcolor(sac and crossDownAll ? red : na, transp=40)
//Not Necessary if you just want Highlight Bars - Extra Feature
//These are just the Letters B and Sell Based on Crosses
plotchar(sl and crossUp ? crossUp : na, title="Buy Signal Strict Criteria", text='BUY on', char='*', location=location.belowbar, color=lime, transp=0, offset=0)
plotchar(sl and crossDn ? crossDn : na, title="Sell Signal Strict Criteria", text='SELL on', char='*', location=location.abovebar, color=red, transp=0, offset=0)
plotchar(sacl and crossUpAll ? crossUpAll : na, title="Buy Signal Any Cross Up", text='BUY on', char='*', location=location.belowbar, color=lime, transp=0, offset=0)
plotchar(sacl and crossDownAll ? crossDownAll : na, title="Sell Signal Any Cross Down", text='SELL on', char='*', location=location.abovebar, color=red, transp=0, offset=0)
파인에디터 열고 복붙 하고 차트에넣기 누르면 끝임 테스트 해보세요
관련자료
-
이전
-
다음
댓글 0
등록된 댓글이 없습니다.