Range breakout code on TradingView
Forums › ProRealTime English forum › ProOrder support › Range breakout code on TradingView
- This topic has 8 replies, 4 voices, and was last updated 4 years ago by
Madrosat.
-
-
03/02/2021 at 3:21 PM #162950
Hi all,
I’m hoping you can help… I came across a strategy on Tradingview that I liked the look of, and believe I can develop on Daily chart as an automated strategy.
I have been staring at this code for a while… Simply, I don’t have the coding knowledge to transfer this over to Prorealtime. Also, I think an expert eye could scrutinise the methodology (just in case I am missing something)
I wondered if anyone would be interested in coding this? Apologies in advance if this is something you do not do.
Link to script https://uk.tradingview.com/u/guikroth/#published-scripts
Tradingview1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192//////////////////////////////////////////////////////////////////////////// Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters//////////////////////////////////////////////////////////////////////////study(title="Range Filter Buy and Sell 5min", overlay=true)// Sourcesrc = input(defval=close, title="Source")// Sampling Period// Settings for 5min chart, BTCUSDC. For Other coin, change the paremetersper = input(defval=100, minval=1, title="Sampling Period")// Range Multipliermult = input(defval=3.0, minval=0.1, title="Range Multiplier")// Smooth Average Rangesmoothrng(x, t, m)=>wper = (t*2) - 1avrng = ema(abs(x - x[1]), t)smoothrng = ema(avrng, wper)*msmoothrngsmrng = smoothrng(src, per, mult)// Range Filterrngfilt(x, r)=>rngfilt = xrngfilt := x > nz(rngfilt[1]) ? ((x - r) < nz(rngfilt[1]) ? nz(rngfilt[1]) : (x - r)) : ((x + r) > nz(rngfilt[1]) ? nz(rngfilt[1]) : (x + r))rngfiltfilt = rngfilt(src, smrng)// Filter Directionupward = 0.0upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])downward = 0.0downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])// Target Bandshband = filt + smrnglband = filt - smrng// Colorsfiltcolor = upward > 0 ? lime : downward > 0 ? red : orangebarcolor = (src > filt) and (src > src[1]) and (upward > 0) ? lime : (src > filt) and (src < src[1]) and (upward > 0) ? green :(src < filt) and (src < src[1]) and (downward > 0) ? red : (src < filt) and (src > src[1]) and (downward > 0) ? maroon : orangefiltplot = plot(filt, color=filtcolor, linewidth=3, title="Range Filter")// Targethbandplot = plot(hband, color=aqua, transp=100, title="High Target")lbandplot = plot(lband, color=fuchsia, transp=100, title="Low Target")// Fillsfill(hbandplot, filtplot, color=aqua, title="High Target Range")fill(lbandplot, filtplot, color=fuchsia, title="Low Target Range")// Bar Colorbarcolor(barcolor)// Break OutslongCond = nashortCond = nalongCond := ((src > filt) and (src > src[1]) and (upward > 0)) or ((src > filt) and (src < src[1]) and (upward > 0))shortCond := ((src < filt) and (src < src[1]) and (downward > 0)) or ((src < filt) and (src > src[1]) and (downward > 0))CondIni = 0CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]longCondition = longCond and CondIni[1] == -1shortCondition = shortCond and CondIni[1] == 1//Alertsplotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = white, style=shape.labelup, size = size.normal, location=location.belowbar, color = green, transp = 0)plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = red, transp = 0)alertcondition(longCondition, title="Buy Alert", message = "BUY")alertcondition(longCondition, title="Buy Alert", message = "BUY")alertcondition(longCondition, title="Buy Alert", message = "BUY")alertcondition(shortCondition, title="Sell Alert", message = "SELL")03/04/2021 at 11:41 AM #163112Same indicator as this one: Range filter but with arrows BUY/SELL when the trend change from green to red and vice-versa.
1 user thanked author for this post.
03/04/2021 at 12:12 PM #16311703/06/2021 at 8:49 AM #163265Bonjour comment créer un signal au changement de couleur du Range filter?? Ou comment créer un screener qui détecte ces changements??Hello, how do you create a signal when the Range filter changes color ?? Or how do you create a screener that detects these changes?
03/06/2021 at 10:09 AM #16328403/06/2021 at 2:16 PM #16329403/06/2021 at 3:54 PM #163309Fixing posted errors is no fun at all. Everyone has five minutes after submitting a post to delete it or edit it and it would be helpful if forum members could double check what they have submitted to ensure that it is correct before leaving the page. This would considerably help moderators reduce their workload keeping the forums tidy and leave them with more time to answer questions.
As for your question – do you not think that if I knew the answer I would have given it? I did not create the indicator, I have never used the indicator and I know nothing about the indicator. I do however know the difference between French and English so can tell you when you have posted in the wrong language… but it is better if I don’t have to. 😉
03/08/2021 at 10:21 AM #163421RangeFilter screener can be found here: https://www.prorealcode.com/topic/screener-range-filter/#post-156392
03/08/2021 at 7:23 PM #163510 -
AuthorPosts
Find exclusive trading pro-tools on