커뮤니티

부탁드립니다

프로필 이미지
파생돌이
2025-09-29 16:10:07.0
61
글번호 194379
답변완료
수고하십니다 예스로 부탁드립니다 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Credits to the original s c ript - Range Filter DonovanWall https://www.tradingview.com/s c ript/lut7sBgG-Range-Filter-DW/ // This version is the old version of the Range Filter with less settings to tinker with //@version=4 study(title="Range Filter - B&S Signals", shorttitle="RF - B&S Signals", overlay=true) //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Functions //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Size Function rng_size(x, qty, n)=> // AC = Cond_EMA(abs(x - x[1]), 1, n) wper = (n*2) - 1 avrng = ema(abs(x - x[1]), n) AC = ema(avrng, wper)*qty rng_size = AC //Range Filter Function rng_filt(x, rng_, n)=> r = rng_ var rfilt = array.new_float(2, x) array.set(rfilt, 1, array.get(rfilt, 0)) if x - r > array.get(rfilt, 1) array.set(rfilt, 0, x - r) if x + r < array.get(rfilt, 1) array.set(rfilt, 0, x + r) rng_filt1 = array.get(rfilt, 0) hi_band = rng_filt1 + r lo_band = rng_filt1 - r rng_filt = rng_filt1 [hi_band, lo_band, rng_filt] //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Inputs //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Source rng_src = input(defval=close, type=input.source, title="Swing Source") //Range Period rng_per = input(defval=20, minval=1, title="Swing Period") //Range Size Inputs rng_qty = input(defval=3.5, minval=0.0000001, title="Swing Multiplier") //Bar Colors use_barcolor = input(defval=false, type=input.bool, title="Bar Colors On/Off") //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Definitions //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Filter Values [h_band, l_band, filt] = rng_filt(rng_src, rng_size(rng_src, rng_qty, rng_per), rng_per) //Direction Conditions var fdir = 0.0 fdir := filt > filt[1] ? 1 : filt < filt[1] ? -1 : fdir upward = fdir==1 ? 1 : 0 downward = fdir==-1 ? 1 : 0 //Trading Condition longCond = rng_src > filt and rng_src > rng_src[1] and upward > 0 or rng_src > filt and rng_src < rng_src[1] and upward > 0 shortCond = rng_src < filt and rng_src < rng_src[1] and downward > 0 or rng_src < filt and rng_src > rng_src[1] and downward > 0 CondIni = 0 CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1] longCondition = longCond and CondIni[1] == -1 shortCondition = shortCond and CondIni[1] == 1 //Colors filt_color = upward ? #05ff9b : downward ? #ff0583 : #cccccc bar_color = upward and (rng_src > filt) ? (rng_src > rng_src[1] ? #05ff9b : #00b36b) : downward and (rng_src < filt) ? (rng_src < rng_src[1] ? #ff0583 : #b8005d) : #cccccc //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Outputs //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Filter Plot filt_plot = plot(filt, color=filt_color, transp=67, linewidth=3, title="Filter") //Band Plots h_band_plot = plot(h_band, color=color.new(#05ff9b, 100), title="High Band") l_band_plot = plot(l_band, color=color.new(#ff0583, 100), title="Low Band") //Band Fills fill(h_band_plot, filt_plot, color=color.new(#00b36b, 92), title="High Band Fill") fill(l_band_plot, filt_plot, color=color.new(#b8005d, 92), title="Low Band Fill") //Bar Color barcolor(use_barcolor ? bar_color : na) //Plot Buy and Sell Labels plotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.new(color.green, 0)) plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.new(color.red, 0)) //Alerts alertcondition(longCondition, title="Buy Alert", message = "BUY") alertcondition(shortCondition, title="Sell Alert", message = "SELL")
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-09-30 09:45:07.0

안녕하세요 예스스탁입니다. input : rng_per(20); input : rng_qty(3.5); input : use_barcolor(false); var : rng_src(0); rng_src = close; var : wper(0),avrng(0),ac(0),rng_size(0); wper = (rng_per*2) - 1; avrng = ema(abs(rng_src - rng_src[1]), rng_per); AC = ema(avrng, wper)*rng_qty; rng_size = AC; var : r(0),rng_filt1(0),h_band(0),l_band(0),filt(0); Array : rfilt[2](close); r = rng_size; rfilt[1] = rfilt[0]; if rng_src - r > rfilt[1] Then rfilt[0] = rng_src - r; if rng_src + r < rfilt[1] Then rfilt[0] = rng_src + r; rng_filt1 = rfilt[0]; h_band = rng_filt1 + r; l_band = rng_filt1 - r; filt = rng_filt1; //Direction Conditions var : fdir(0),upward(0),downward(0); fdir = iff(filt > filt[1] , 1 , iff(filt < filt[1] , -1 , fdir)); upward = iff(fdir==1 , 1 , 0); downward = iff(fdir==-1 , 1 , 0); //Trading Condition var : longCond(False),shortCond(False),CondIni(0),longCondition(False),shortCondition(False); longCond = rng_src > filt and rng_src > rng_src[1] and upward > 0 or rng_src > filt and rng_src < rng_src[1] and upward > 0; shortCond = rng_src < filt and rng_src < rng_src[1] and downward > 0 or rng_src < filt and rng_src > rng_src[1] and downward > 0; CondIni = 0; CondIni = iff(longCond , 1 , iff(shortCond , -1 , CondIni[1])); longCondition = longCond and CondIni[1] == -1; shortCondition = shortCond and CondIni[1] == 1; //Colors var : filt_color(0); filt_color = iff(upward , Lime, iff(downward , Red , Black)); //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Outputs //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Filter Plot plot1(filt,"Filter",filt_color,Def,1); plot2(h_band,"High Band",Lime); plot3(l_band,"Low Band",Red); var : tx(0); if longCondition == true Then { tx = Text_New(sDate,sTime,filt,"▲"); Text_SetColor(tx,lime); Text_SetStyle(tx,2,0); Text_SetSize(tx,20); } if shortCondition == true Then { tx = Text_New(sDate,sTime,filt,"▼"); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); Text_SetSize(tx,20); } 즐거운 명절 되시기 바랍니다. > 파생돌이 님이 쓴 글입니다. > 제목 : 부탁드립니다 > 수고하십니다 예스로 부탁드립니다 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Credits to the original s c ript - Range Filter DonovanWall https://www.tradingview.com/s c ript/lut7sBgG-Range-Filter-DW/ // This version is the old version of the Range Filter with less settings to tinker with //@version=4 study(title="Range Filter - B&S Signals", shorttitle="RF - B&S Signals", overlay=true) //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Functions //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Size Function rng_size(x, qty, n)=> // AC = Cond_EMA(abs(x - x[1]), 1, n) wper = (n*2) - 1 avrng = ema(abs(x - x[1]), n) AC = ema(avrng, wper)*qty rng_size = AC //Range Filter Function rng_filt(x, rng_, n)=> r = rng_ var rfilt = array.new_float(2, x) array.set(rfilt, 1, array.get(rfilt, 0)) if x - r > array.get(rfilt, 1) array.set(rfilt, 0, x - r) if x + r < array.get(rfilt, 1) array.set(rfilt, 0, x + r) rng_filt1 = array.get(rfilt, 0) hi_band = rng_filt1 + r lo_band = rng_filt1 - r rng_filt = rng_filt1 [hi_band, lo_band, rng_filt] //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Inputs //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Source rng_src = input(defval=close, type=input.source, title="Swing Source") //Range Period rng_per = input(defval=20, minval=1, title="Swing Period") //Range Size Inputs rng_qty = input(defval=3.5, minval=0.0000001, title="Swing Multiplier") //Bar Colors use_barcolor = input(defval=false, type=input.bool, title="Bar Colors On/Off") //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Definitions //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Range Filter Values [h_band, l_band, filt] = rng_filt(rng_src, rng_size(rng_src, rng_qty, rng_per), rng_per) //Direction Conditions var fdir = 0.0 fdir := filt > filt[1] ? 1 : filt < filt[1] ? -1 : fdir upward = fdir==1 ? 1 : 0 downward = fdir==-1 ? 1 : 0 //Trading Condition longCond = rng_src > filt and rng_src > rng_src[1] and upward > 0 or rng_src > filt and rng_src < rng_src[1] and upward > 0 shortCond = rng_src < filt and rng_src < rng_src[1] and downward > 0 or rng_src < filt and rng_src > rng_src[1] and downward > 0 CondIni = 0 CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1] longCondition = longCond and CondIni[1] == -1 shortCondition = shortCond and CondIni[1] == 1 //Colors filt_color = upward ? #05ff9b : downward ? #ff0583 : #cccccc bar_color = upward and (rng_src > filt) ? (rng_src > rng_src[1] ? #05ff9b : #00b36b) : downward and (rng_src < filt) ? (rng_src < rng_src[1] ? #ff0583 : #b8005d) : #cccccc //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Outputs //----------------------------------------------------------------------------------------------------------------------------------------------------------------- //Filter Plot filt_plot = plot(filt, color=filt_color, transp=67, linewidth=3, title="Filter") //Band Plots h_band_plot = plot(h_band, color=color.new(#05ff9b, 100), title="High Band") l_band_plot = plot(l_band, color=color.new(#ff0583, 100), title="Low Band") //Band Fills fill(h_band_plot, filt_plot, color=color.new(#00b36b, 92), title="High Band Fill") fill(l_band_plot, filt_plot, color=color.new(#b8005d, 92), title="Low Band Fill") //Bar Color barcolor(use_barcolor ? bar_color : na) //Plot Buy and Sell Labels plotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = color.white, style=shape.labelup, size = size.normal, location=location.belowbar, color = color.new(color.green, 0)) plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = color.white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = color.new(color.red, 0)) //Alerts alertcondition(longCondition, title="Buy Alert", message = "BUY") alertcondition(shortCondition, title="Sell Alert", message = "SELL")