Hello, i hope someone can help me and can convert the attached open source code
Forums › ProRealTime English forum › ProBuilder support › Hello, i hope someone can help me and can convert the attached open source code
- This topic has 6 replies, 2 voices, and was last updated 7 months ago by Iván.
Viewing 7 posts - 1 through 7 (of 7 total)
-
-
02/08/2024 at 3:02 PM #227666
Hello,
I hope someone can help me and can convert the attached source code from tradingview. I want to use this SRChannel indicator in prorealtime. Many thanks in advance!
Regards
14S
02/19/2024 at 8:08 AM #228375Hi,
Is there anyone who can help me? It would be really appreciated.
Regards
02/19/2024 at 8:57 AM #22837702/19/2024 at 9:02 AM #228378Thanks in advance for your effort.
04/20/2024 at 11:57 AM #231732Hi Ivan, any luck with my request above. Thanks
04/22/2024 at 8:11 AM #23179304/23/2024 at 2:47 PM #231858Here it is:
https://www.prorealcode.com/prorealtime-indicators/demand-supply-zones-indicator/123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183//--------------------------------------------------------////PRC_Demand/Supply Zones//version = 0//08.04.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------------------////-----inputs--------------------------------------------//prd = 10 //Pivot periodppsrc = 1// 1 = "high/low" // 0 = "close/open"showpp = 1//Show Pivot Pointschannelw = 5 //Maximum channel width %maxnumsr = 6 //Maximum Number of S/Rloopback = 290 //Loopback PeriodShowEMA = 0 //Show moving averagesma1len = 50 //MA 1ma1type = 0 //sma=0 ema=1ma2len = 200 //MA 2ma2type = 0 //sma=0 ema=1//-------------------------------------------------------////-----AVERAGES------------------------------------------//if ShowEMA thenma1 = average[ma1len,ma1type](close)ma2 = average[ma2len,ma2type](close)elsema1 = undefinedma2 = undefinedendif//-------------------------------------------------------////-----Get Pivot high / low------------------------------//if ppsrc thensrc1 = lowsrc2 = highelsesrc1 = max(close,open)src2 = min(close,open)endif//-----pivots lowif src1 > src1[prd] and lowest[prd](src1) > src1[prd] and src1[prd] < lowest[prd](src1)[prd+1] then$pivotlowy[z+1] = src1[prd]$pivotlowx[z+1] = barindex[prd]z=z+1endif//-----pivots highif src2 < src2[prd] and highest[prd](src2)<src2[prd] and src2[prd]>highest[prd](src2)[prd+1] then$pivothighy[t+1]=src2[prd]$pivothighx[t+1]=barindex[prd]t=t+1endif//-------------------------------------------------------////-----Draw pivot points---------------------------------//if showpp and z <> z[1] thendrawpoint($pivotlowx[z],$pivotlowy[z],2)coloured("red",50)elsif showpp and t <> t[1] thendrawpoint($pivothighx[t],$pivothighy[t],2)coloured("blue",50)endif//-------------------------------------------------------////-----Calculate maximum S/R channel width---------------//prdhighest = highest[300](high)prdlowest = lowest[300](low)cwidth = (prdhighest - prdlowest) * ChannelW / 100//-------------------------------------------------------////-----Get/keep Pivot levels-----------------------------//if z <> z[1] then$pivotvals[m+1]=src1[prd]$pivotlocs[m+1]=barindex[prd]m=m+1elsif t <> t[1] then$pivotvals[m+1]=src2[prd]$pivotlocs[m+1]=barindex[prd]m=m+1endif//-------------------------------------------------------////-----Calculate Strengs---------------------------------//if islastbarupdate then//get levels and strengsfor x=0 to m-1 dolo=$pivotvals[x]hi=lonumpp=0for Y= 0 to m-1 docpp=$pivotvals[y]if cpp <=hi thenwdth=hi-cppelsewdth=cpp-loendifif wdth<=cwidth thennumpp=numpp+20if cpp<=hi thenlo=min(lo,cpp)elsehi=max(hi,cpp)endifendifnext$lo[x]=lo$hi[x]=hi$strength[x]=numppnext//add each HL to strenghfor z=0 to m-1 dolo2=$lo[z]hi2=$hi[z]s=0for t=0 to loopback doif (high[t]<=hi2 and high[t]>=lo2) or (low[t]<=hi2 and low[t]>=lo2) thens=s+1endif$strength[z]=$strength[z]+snextnextendif//-------------------------------------------------------////-----Support&Resistance levels Array-------------------////reset SR levelsunset($suportresistance)// get strongest SRssrc=0for i=0 to m-1 dostv=-1stl=-1for j=0 to m-1 doif $strength[j]>stv and $strength[j]>=20 thenstv=$strength[j]stl=jendifnextif stl>=0 then//get sr levelhh=$hi[stl]ll=$lo[stl]$suportresistance[src*2]=hh$suportresistance[src*2+1]=ll$stren[src]=$strength[stl]// make included pivot points' strength zerofor n=0 to m-1 doif ($hi[n]<=hh and $hi[n]>=ll) or ($lo[n]<=hh and $lo[n]>=ll) then$strength[n]=-1endifnextsrc=src+1if src>=10 thenbreakendifendifnext//-------------------------------------------------------////-----Draw Support&Resistance---------------------------//for x=0 to min(9,maxnumsr-1) do//Calculate Top levelif x*2 < LastSet($suportresistance) thenif $suportresistance[x*2] <> 0 thenboxtop = $suportresistance[x*2]endifendif//Calculate Bottom levelif x*2+1 < LastSet($suportresistance) thenif $suportresistance[x*2+1] <> 0 thenboxbot = $suportresistance[x*2+1]endifendif//Color definitionif close > boxtop thenr=0g=255b=0elsif close < boxbot thenr=255g=0b=0elser=255g=255b=50endif//Draw rectangledrawrectangle(0,boxtop,barindex,boxbot)coloured(r,g,b,0)fillcolor(r,g,b,50)next//-------------------------------------------------------//return ma1 as "SMA 1" coloured("blue"),ma2 as "SMA 2" coloured("red") -
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)
Find exclusive trading pro-tools on
Similar topics: