VPA Indicator & Volume Spread Analysis
Forums › ProRealTime English forum › ProBuilder support › VPA Indicator & Volume Spread Analysis
- This topic has 8 replies, 4 voices, and was last updated 1 month ago by
Iván.
-
-
01/17/2025 at 6:23 PM #242733
Hello, I am new to ProrReal Time and assessing the functionalities.
Is anybody familiar with the VPA indicator? I have been using on US market for ever and it is very powerful. I am not sure how complex it would to code it in ProRealTime?
code from trading View here:
VPA ANALYSIS by karthikmarar — Pine Script™ Editor
Experiments in Technical Analysis
I would love to meet coder and specialist of PRT as I am trying to get advice on what isdoable – my us database do not do European stocks so am trying to replicate lots of technical (and fundamental screening) indicators for EU markets
best regards
Frederic Batoua
[Email address removed by moderators, please see yellow box at bottom of page just before the “submit” message button, highlighting main forum rules, thanks]
01/17/2025 at 6:49 PM #242734code from trading View here:
You will get a better response if you post / show the code on here, ideally using the blue ‘Insert PRT Code’ button at the far right of the toolbar (but often the ‘blue button’ does not show … try refreshing your screen a few times and / or clear your cache for this website).
01/17/2025 at 6:51 PM #24273501/17/2025 at 8:14 PM #242739tudy(“VPA ANALYSIS “, overlay=true)trind = input(title=”Trend Indication”, type=input.bool, defval=false)bkbg = input(title=”Black Background”, type=input.bool, defval=false)plot50 = input(title=”Plot 50 MA”, type=input.bool, defval=false)plot200 = input(title=”Plot 200 MA”, type=input.bool, defval=false)plot(plot50? sma(close,50): na, color= color.blue, style = plot.style_line )plot(plot200? sma(close,200): na, color= color.red, style = plot.style_line )//===================== Basic Definitions =======================================volAvg = sma(volume,40)volMean = stdev(volAvg,30)volUpBand3 = volAvg + (3*volMean)volUpBand2 = volAvg + (2*volMean)volUpBand1 = volAvg + (1*volMean)volDnBand1 = volAvg -(1*volMean)volDnBand2 = volAvg – (2*volMean)H = highL = lowV = volumeC = closemidprice = (H+L)/2spread = (H-L)avgSpread = sma(spread,40)AvgSpreadBar = spread > avgSpread// to be checkedwideRangeBar = spread>(1.5*avgSpread)narrowRangeBar = spread<(0.7*avgSpread)lowVolume = V<volume[1] and V<volume[2] and V <volAvg // modsupBar = C>close[1]//C>Ref(C,-1)downBar = C<close[1]//C<Ref(C,-1)highVolume = V>volume[1] and volume[1]>volume[2]// ReviewcloseFactor = C-LclsPosition = spread/closeFactorclosePosition = ((closeFactor == 0) ? (avgSpread) : (clsPosition))vb = V > volAvg or V> volume[1]upClose = C>=((spread*0.7)+L)// close is above 70% of the BardownClose = C<=((spread*0.3)+L)// close is below the 30% of the baraboveClose = C>((spread*0.5)+L)// close is between 50% and 70% of the barbelowClose = C<((spread*0.5)+L)// close is between 50% and 30% of the barmidClose = C>((spread*0.3)+L) and C<((spread*0.7)+L)// close is between 30% and 70% of the barveryLowClose = closePosition>4//close is below 25% of the barveryHighClose = closePosition<1.35// Close is above 80% of the barClosePos = iff(C<=((spread*0.2)+L),1,iff(C<=((spread*0.4)+L),2,iff(C<=((spread*0.6)+L),3,iff(C<=((spread*0.8)+L),4,5))))//1 = downClose, 2 = belowClose, 3 = midClose, 4 = aboveClose, 6 = upClosevolpos = iff(V>(volAvg*2),1,iff(V>(volAvg*1.3),2,iff(V>volAvg,3,iff(V<volAvg and (V<volAvg*0.7) ,4,5))))//1 = veryhigh, 2 = High , 3 = AboveAverage, 4 = volAvg //LessthanAverage, 5 = lowVolumefreshGndHi = high == highest(high,5)?1:0freshGndLo = low == lowest(low,5)?1:0//=========================================================================|// Trend Analysis Module |//=========================================================================|psmin = input(2,”Short term Min periods”, input.integer, minval=1, maxval=9, step=1)psmax = input(8,”Short term Max Periods”, input.integer, minval=1, maxval=9, step=1)rshmin = (high – nz(low[psmin])) / (atr(psmin) * sqrt(psmin))rshmax = (high – nz(low[psmax])) / (atr(psmax) * sqrt(psmax))RWIHi = max(rshmin,rshmax)rslmin = (nz(high[psmin]) – low) / (atr(psmin) * sqrt(psmin))rslmax = (nz(high[psmax]) – low) / (atr(psmax) * sqrt(psmax))RWILo = max(rslmin,rslmax)k = RWIHi-RWILoground = RWIHisky = RWILoplmin=input(10,”Long Term Min Periods”,type=input.integer,minval=1,maxval=32,step=1)plmax=input(40,”Long term Max Periods”,type=input.integer,minval=1,maxval=64,step=1)rlhmin = (high – nz(low[plmin])) / (atr(plmin) * sqrt(plmin))rlhmax = (high – nz(low[plmax])) / (atr(plmax) * sqrt(plmax))RWILHi = max(rlhmin,rlhmax)rllmin = (nz(high[plmin]) – low) / (atr(plmin) * sqrt(plmin))rllmax = (nz(high[plmax]) – low) / (atr(plmax) * sqrt(plmax))RWILLo = max(rllmin,rllmax)j = RWILHi-RWILLoj2 =RWILHik2 =RWILLoja = crossover(j,1) // The following section check the diffeent condition of the RWi above and below zerojb = crossover(1,j) // In oder to check which trend is doing whatjc = crossover(-1,j)jd = crossover(j,-1)j2a = crossover(j2,1)j2b = crossover(1,j2)k2a = crossover(k2,1)k2b = crossover(1,k2)//Define the Major, Minor and Immediate trend Statusupmajoron = j > 1 and ja[1]upmajoroff = j < 1 and jb[1]upminoron = j2 > 1 and j2a[1]upminoroff = j2 < 1 and j2b[1]dnmajoron = j < -1 and jc[1]dnmajoroff = j > -1 and jd[1]dnminoron = k2 > 1 and k2a[1]dnminoroff = k2 < 1 and k2b[1]upmid = iff(ground > 1, 1,0)dnimd = iff(sky > 1, 1, 0)upmajor = iff(j>1,1,iff(j<(-1),-1,0))upminor = iff(j2>1,1,-1)dnminor = iff(k2>1,1,-1)plotshape(upmajor ==1 and trind == true , text=””,style=shape.triangledown, color= color.lime, location=location.top,transp=0, size= size.small)plotshape(upmajor == -1 and trind == true , text=””,style=shape.triangledown, color=color.red, location=location.top,transp=0, size = size.small)plotshape(upmajor != -1 and upmajor != 1 and trind == true , text=””,style=shape.triangledown, color=color.yellow, location=location.top,transp=0, size = size.small)plotshape(upmid ==1 and trind == true , text=””,style=shape.circle, color= color.lime, location=location.top,transp=0,size = size.tiny)plotshape(upmid == -1 and trind == true , text=””,style=shape.circle, color= color.red, location=location.top,transp=0,size = size.tiny)plotshape(upmid != -1 and upmid !=1 and trind == true , text=””,style=shape.circle, color= color.yellow, location=location.top,transp=0,size = size.tiny)plotshape(upminor == 1 and trind == true , text=””,style=shape.square, color= color.lime, location=location.top,transp=0 )plotshape(upminor == -1 and trind == true , text=””,style=shape.square, color= color.red, location=location.top,transp=0)plotshape(upminor != 1 and upminor != -1 and trind == true , text=””,style=shape.square, color= color.yellow, location=location.top,transp=0)//=========================================================================|// Slope Calculation |//=========================================================================|src = sma(close,5)//————–longterm trend—————lts = linreg(src, 40, 0)ltsprev = linreg(close[3], 40, 0)ltsslope = ((lts – ltsprev) / 3 )//————-Medium Term Trend————-mts = linreg(src, 20, 0)mtsprev = linreg(close[3], 20, 0)mtsslope = ((mts – mtsprev) / 3 )//————-short Term Trend————-sts = linreg(src, 3, 0)stsprev = linreg(close[1], 3, 0)stsslope = ((sts – stsprev) / 2 )tls = stsslope//=========================================================================|// VSA SIGNAL GENERATION |//=========================================================================|upThrustBar = wideRangeBar and downClose and high > high[1] and upmid==1 //WRB and UHS in midterm trendnut = wideRangeBar and downClose and freshGndHi and highVolume // NEW SIGNAL – Upthrust after new short up movebc = wideRangeBar and aboveClose and volume == highest(volume,60) and upmajor==1 // Buying ClimaxupThrustBar1 = wideRangeBar and (ClosePos==1 or ClosePos==2) and upminor>0 and H>H[1]and (upmid>0 or upmajor>0) and volpos < 4 // after minor up trendupThrustBartrue = wideRangeBar and ClosePos==1 and upmajor>0 and H>H[1] and volpos < 4//occurs after a major uptrendupThrustCond1 = upThrustBar[1] and downBar and not narrowRangeBar // The Bar after Upthrust Bar- Confirms weaknessupThrustCond2 = upThrustBar[1] and downBar and V>(volAvg*1.3) // The Bar after Upthrust Bar- Confirms weaknessupThrustCond3 = upThrustBar and V>(volAvg*2) // ReviewtopRevBar = V[1]>volAvg and upBar[1] and wideRangeBar[1] and downBar and downClose and wideRangeBar and upmajor>0 and H==highest(H,10)// Top Reversal barPseudoUpThrust = (upBar[1])and H>H[1] and V[1]>1.5*volAvg and downBar and downClose and not upThrustBarpseudoUtCond = PseudoUpThrust[1] and downBar and downClose and not upThrustBartrendChange = upBar[1] and H==highest(H,5) and downBar and (downClose or midClose) and V>volAvg and upmajor>0 and upmid>0 and not wideRangeBar and not PseudoUpThrustnoDemandBarUt = upBar and narrowRangeBar and lowVolume and (aboveClose or upClose) and ((upminor>=0 and upmid>=0) or (upminor<=0 and upminor>=0))//in a up marketnoDemandBarDt = upBar and narrowRangeBar and lowVolume and (aboveClose or upClose) and (upminor<=0 or upmid<=0)// in a down or sidewayss marketnoSupplyBar = downBar and narrowRangeBar and lowVolume and midCloselowVolTest = low == lowest(low,5) and upClose and lowVolumelowVolTest1 = low == lowest(low,5) and V<volAvg and L<L[1] and upClose and upminor>0 and upmajor>0lowVolTest2 = lowVolTest[1] and upBar and upClosesellCond1 = (upThrustCond1 or upThrustCond2 or upThrustCond3)sellCond2 = sellCond1[1]==0sellCond = sellCond1 and sellCond2strengthDown0 = upmajor<0 and volpos < 4 and downBar[1] and upBar and ClosePos>3 and upminor <0 and upmid <=0strengthDown = volpos<4 and downBar[1] and upBar and ClosePos>3 and upmid<=00 and upminor<0 // Strength after a down trendstrengthDown1 = upmajor<0 and V>(volAvg*1.5) and downBar[1] and upBar and ClosePos>3 and upmid<=00 and upminor<0strengthDown2 = upmid<=0 and V[1]<volAvg and upBar and veryHighClose and volpos<4buyCond1 = strengthDown or strengthDown1buyCond = upBar and buyCond1[1]stopVolume = L==lowest(L,5) and (upClose or midClose) and V>1.5*volAvg and upmajor<0revUpThrust = upBar and upClose and V>V[1] and V>volAvg and wideRangeBar and downBar[1] and downClose[1] and upminor<0effortUp =H>H[1]andL>L[1]andC>C[1]andC>=((H-L)*0.7+L)andspread>avgSpreadandvolpos<4effortUpfail = effortUp[1] and (upThrustBar or upThrustCond1 or upThrustCond2 or upThrustCond3 or (downBar and AvgSpreadBar))effortDown =H<H[1]andL<L[1]andC<C[1]andC<=((H-L)*0.25+L)andwideRangeBarandV>V[1]effortDownFail = effortDown[1] and ((upBar and AvgSpreadBar) or revUpThrust or buyCond1)upflag = (sellCond or buyCond or effortUp or effortUpfail or stopVolume or effortDown or effortDownFail or revUpThrust or noDemandBarDt or noDemandBarUt or noSupplyBar or lowVolTest or lowVolTest1 or lowVolTest2 or bc)bullBar = (V>volAvg or V>V[1]) and C<=((spread*0.2)+L) and upBar and not upflagbearBar = vb and downClose and downBar and spread>avgSpread and not upflag//=============================== PLOT SHAPES SECTION============================//UPTHRUSTSplotshape((upThrustBarorupThrustBartrue)andnoteffortUpfailandnotsellCondandnotbc,”UT1″,style=shape.triangledown,location=location.abovebar,color=#990000,transp=0,text=”UT1″,textcolor=#990000,editable=false,size=size.tiny)UT1 = upThrustBar or upThrustBartrueplotshape((upThrustCond1orupThrustCond2ornut)andnoteffortUpfailandnotsellCondandnotbc,”UT2″,style=shape.triangledown,location=location.abovebar,color=#ff0000,transp=0,text=”UT2″,textcolor=#ff0000,editable=false,size=size.tiny)UT2 = upThrustCond1 or upThrustCond2UT = UT1 or UT2alertcondition(upThrustBar, title=’Alert on UT1 an UT2 and UT’, message=’An Upthrust Bar. A sign of weakness. High Volume adds weakness. A down bar after Upthrust adds weakness’)plotshape(topRevBarandnotsellCondandnotUTandnoteffortUpfail,”TRB”,style=shape.triangledown,location=location.abovebar,color=#ff9900,transp=0,text=”TRB”,textcolor=#ff9900,editable=false,size=size.tiny)alertcondition(topRevBar , title=’Alert on TRB’, message=’Top Reversal. Sign of Weakness. ‘)plotshape(trendChangeandnoteffortUpfail,”Tch”,style=shape.triangledown,location=location.abovebar,color=#ff471a,transp=0,text=”TC”,textcolor=#ff471a,editable=false,size=size.tiny)alertcondition(trendChange , title=’Alert on TCH’, message=’High volume Downbar after an upmove on high volume indicates weakness. ‘)plotshape(PseudoUpThrustandnoteffortUpfail,”PUT”,style=shape.triangledown,location=location.abovebar,color=#ff471a,transp=0,text=”PUT”,textcolor=#ff471a,editable=false,size=size.tiny)plotshape(pseudoUtCondandnoteffortUpfail,”PUC”,style=shape.triangledown,location=location.abovebar,color=#ff471a,transp=0,text=”PUC”,textcolor=#ff471a,editable=false,size=size.tiny)alertcondition(PseudoUpThrustorpseudoUtCond ,title=’Alert on PUT and PUC’,message=’Psuedo UpThrust. A Sign of Weakness.A Down Bar closing down after a Pseudo Upthrust confirms weakness. ‘)plotshape(noDemandBarUt,”ND”,style=shape.circle,location=location.abovebar,color=#ff471a,transp=0,text=”ND”,textcolor=#ff471a,editable=false,size=size.tiny)plotshape(noDemandBarDt,”ND”,style=shape.circle,location=location.abovebar,color=#e6e600,transp=0,text=”ND”,textcolor=#ff471a,editable=false,size=size.tiny)alertcondition(noDemandBarUtornoDemandBarDt ,title=’Alert on ND’,message=’No Demand in a Uptrend. A sign of Weakness. Otherwise upside unlikely soon ‘)plotshape(noSupplyBar,”NS”,style=shape.circle,location=location.belowbar,color=color.lime,transp=0,text=”NS”,textcolor=color.green,editable=false,size=size.tiny)alertcondition(noSupplyBar,title=’Alert on NS’,message=’No Supply. A sign of Strength. ‘)plotshape(lowVolTestandnoteffortDownFail,”LVT”,style=shape.circle,location=location.belowbar,color=color.lime,transp=0,text=”LVT”,textcolor=color.green,editable=false,size=size.tiny)plotshape(lowVolTest2andnoteffortUp,”ST”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST”,textcolor=color.green,editable=false,size=size.tiny)lvt = lowVolTest or lowVolTest2alertcondition(lvt,title=’Alert on LVT’,message=’Test for supply.An upBar closing near High after a Test confirms strength. ‘)//————————————————-EFD = effortDownFailST1 = strengthDown0ST2 = strengthDown and not strengthDown2strcond = (strengthDown2 and not strengthDown0 and not strengthDown and not strengthDown1)? 1:0ST3 = strengthDown1ST4 = strengthDown2 and strcondST5 = strengthDown2 and not strcondST = ST1 or ST2 or ST3 or ST4 or ST5plotshape(strengthDown0andnotEFDandnoteffortUpandnotstopVolume,”ST1″,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST1″,textcolor=color.green,editable=false,size=size.tiny)plotshape(strengthDownandnotstrengthDown2andnotEFDandnoteffortUpandnotstopVolume,”ST2″,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST1″,textcolor=color.green,editable=false,size=size.tiny)plotshape(strengthDown1 and not EFD and not effortUp and not stopVolume, “ST3″, style=shape.triangleup, location=location.belowbar, color=color.lime, transp=0, text=”ST1”, textcolor=color.green, editable=false, size=size.auto)plotshape(strengthDown2andstrcondandnotEFDandnoteffortUpandnotstopVolume,”ST4″,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST2″,textcolor=color.green,editable=false,size=size.tiny)alertcondition(ST,title=’Alert on ST1, ST2, ST3, ST4 and ST’,message=’Strength seen returning after a down trend. ‘)//———————————————-//—————————————————plotshape(stopVolumeandnotST,”SV”,style=shape.circle,location=location.belowbar,color=color.lime,transp=0,text=”SV”,textcolor=color.green,editable=false,size=size.auto)plotshape(stopVolumeandST,”SV”,style=shape.circle,location=location.belowbar,color=color.lime,transp=0,text=”ST\nSV”,textcolor=color.green,editable=false,size=size.auto)alertcondition(stopVolume,title=’Alert on SV’,message=’Stopping volume. Normally indicates end of bearishness is nearing. ‘)plotshape(effortUpandnotSTandnotbuyCondandnoteffortDownFail,”EU”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”EU”,textcolor=color.green,editable=false,size=size.tiny)alertcondition(effortUp,title=’Alert on EU’,message=’Effort to Move up. Bullish Sign ‘)plotshape(effortUpandSTandnotbuyCond,”EU”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST\nEU”,textcolor=color.green,editable=false,size=size.tiny)plotshape(effortUpfailandnotUT,”EUF”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”EUF”,textcolor=color.red,editable=false,size=size.tiny)alertcondition(effortUpfail,title=’Alert on EUF’,message=’Effort to Move up Failed. Bearish sign ‘)plotshape(effortDownandnoteffortUpfail,”ED”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”ED”,textcolor=color.green,editable=false,size=size.tiny)alertcondition(effortDown,title=’Alert on ED’,message=’Effort to Move Down. Bearish Sign ‘)plotshape(effortDownFailandnotST,”EDF”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”EDF”,textcolor=color.green,editable=false,size=size.tiny)alertcondition(effortDownFail,title=’Alert on EDF’,message=’Effort to Down Failed. Bullish sign ‘)plotshape(effortDownFailandST,”EDF”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”ST\nEDF”,textcolor=color.green,editable=false,size=size.tiny)plotshape(revUpThrustandnotST,”RUT”,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”RUT”,textcolor=color.green,editable=false,size=size.auto)alertcondition(revUpThrust,title=’Alert on RUT’,message=’Reverse Up Thrust – Bullish ‘)plotshape(buyCondandnotSTandnoteffortUpandnotlvt,”BYC1″,style=shape.triangleup,location=location.belowbar,color=color.lime,transp=0,text=”BYC”,textcolor=color.green,editable=false,size=size.tiny)alertcondition(buyCond,title=’Alert on BYC’,message=’Strength Returns – Buy Condition exist ‘)plotshape(buyCond and not ST and effortUp, “BYC2″, style=shape.triangleup, location=location.belowbar, color=color.lime, transp=0, text=”EU\nBYC”, textcolor=color.green, editable=false, size=size.tiny)plotshape(sellCondandnotUT,”SEC”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”SEC”,textcolor=color.red,editable=false,size=size.tiny)alertcondition(sellCond ,title=’Alert on SEC’,message=’Weakness Returns – Sell Condition exist ‘)plotshape(sellCondandUT,”SEC”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”UT\nSEC”,textcolor=color.red,editable=false,size=size.tiny)plotshape(bcandnotUT,”BC”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”BC”,textcolor=color.red,editable=false,size=size.tiny)alertcondition(bc ,title=’Alert on BC’,message=’Buying Climax – End of Current Up Trend ‘)plotshape(bcandUT,”BC”,style=shape.triangledown,location=location.abovebar,color=color.red,transp=0,text=”UT\nBC”,textcolor=color.red,editable=false,size=size.tiny)//—————————–Bar coloring Code————————————————-//Vlp=Param(“Volume lookback period”,150,20,300,10);Vrg=sma(volume,30)// average volumerg=(high-close)arg=wma(rg,30)Vh=volume>volume[1] and volume[1]>volume[2]Cloc=close-lowx=(high-low)/Clocx1=Cloc==0?arg:xVb1 = volume >Vrg or volume > volume[1]ucls=x1<2dcls=x1>2mcls=x1<2.2andx1>1.8Vlcls=x1>4Vhcls=x1<1.35upbar = close > close[1]dnbar = close < close[1]CloseUp = close > close[1]CloseDn = close < close[1]VolUp = volume > volume[1]VolDn = volume < volume[1]bb1 = upbar and CloseUp and ucls and low > low[1]bb2 = upbar and VolUpbb3 = dnbar and CloseDn and VolDnbb4 = dnbar and CloseDn and close > close[1]db1 = dnbar and CloseDn and dclsdb2 = dnbar and VolUpdb3 = upbar and CloseDn and VolUpdb4 = upbar and CloseDn and close<low[1] and dclsdb5 = upbar and CloseUp and ucls and low<low[1]db6 = upbar and CloseUp and dclsbb=(bb1 or bb2 or bb3 or bb4)db=(db1 or db2 or db3 or db4 or db5 or db6)//neucolor = bkbg == true ? color.white : color.bluemcolor=bbandtls>0?color.green:(dbandtls<0?color.red:(bkbg==true?color.white:color.blue))bgcolor(bkbg==true?color.black:color.white,transp=0, editable=false)barcolor(color=mcolor)01/18/2025 at 5:13 PM #242779Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums
Use the correct forum. Since this is an indicator, the ProBuilder forium should be used.
I move it. I also deleted the other topic in the French forum.
Thanks 🙂
01/20/2025 at 12:25 PM #24284401/30/2025 at 2:47 PM #243227Here it is:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462//------------------------------------------------------////PRC VPA ANALYSIS//version = 0//30.01.25//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//------------------------------------------------------//// inputs//------------------------------------------------------//trind=0 // trend indicationbkbg=0 // black backgroundplot50=1 // Plot sma50plot200=1 // Plot sma200psmin=2 // Short term Min periodspsmax=8 // Short term Max periodsplmin=10 // Long term Min periodsplmax=40 // Long term Max periods//------------------------------------------------------//// basic definitions//------------------------------------------------------//// Simple Moving averagesif plot50 thensma50=average[50](close)elsesma50=undefinedendifif plot200 thensma200=average[200](close)elsesma200=undefinedendif// Volumevolavg=average[40](volume)volmean=std[30](volavg)volUpband3=volavg+3*volmeanvolUpband2=volavg+2*volmeanvolUpband1=volavg+1*volmeanvolDnband1=volavg-1*volmeanvolDnband2=volavg-2*volmeanlowVolume=volume<volume[1] and volume<volume[2] and volume<volavghighVolume=volume>volume[1] and volume[1]>volume[2]vb=volume>volavg and volume>volume[1]// Pricesmidprice=(high+low)/2spread=high-lowavgSpread=average[40](spread)avgSpreadBar=spread>avgspreadwideRangeBar=spread>1.5*avgspreadnarrowRangeBar=spread<0.7*avgspreadupBar=close>close[1]downBar=close<close[1]closeFactor=close-lowclsPosition=spread/closeFactorif closeFactor=0 thenclosePosition=avgSpreadelseclosePosition=clsPositionendifupClose=close>=(spread*0.7+low)downClose=close<=(spread*0.3+low)aboveClose=close>(spread*0.5+low)belowClose=close<(spread*0.5+low)midClose=close>(spread*0.3+low) and close<(spread*0.7+low)veryLowClose=closePosition>4veryHighClose=closePosition<1.35if close<=spread*0.2+low thenClosePos=1elsif close<=spread*0.4+low thenClosePos=2elsif close<=spread*0.6+low thenClosePos=3elsif close<=spread*0.8+low thenClosePos=4elseClosePos=5endifif volume>volavg*2 thenvolPos=1elsif volume>volavg*1.3 thenvolPos=2elsif volume>volavg*1 thenvolPos=3elsif volume>volavg*0.7 thenvolPos=4elsevolPos=5endifif high=highest[5](high) thenfreshGndHi=1elsefreshGndHi=0endifif low=lowest[5](low) thenfreshGndLo=1elsefreshGndLo=0endif//------------------------------------------------------//// Trend Analysis Module//------------------------------------------------------//// Short Termrshmin=(high-low[psmin])/(averagetruerange[psmin](close)*sqrt(psmin))rshmax=(high-low[psmax])/(averagetruerange[psmax](close)*sqrt(psmax))RWIHi=max(rshmin,rshmax)rslmin=(high[psmin]-low)/(averagetruerange[psmin](close)*sqrt(psmin))rslmax=(high[psmax]-low)/(averagetruerange[psmax](close)*sqrt(psmax))RWILo=max(rslmin,rslmax)k=RWIHi-RWILoground=RWIHisky=RWILo// Long Termrlhmin=(high-low[plmin])/(averagetruerange[plmin](close)*sqrt(plmin))rlhmax=(high-low[plmax])/(averagetruerange[plmax](close)*sqrt(plmax))RWILHi=max(rlhmin,rlhmax)rllmin=(high[plmin]-low)/(averagetruerange[plmin](close)*sqrt(plmin))rllmax=(high[plmax]-low)/(averagetruerange[plmax](close)*sqrt(plmax))RWILLo=max(rllmin,rllmax)j=RWILHi-RWILLoj2=RWILHik2=RWILLoja=j crosses over 1jb=j crosses under 1jc=j crosses under -1jd=j crosses over -1j2a=j2 crosses over 1j2b=j2 crosses under 1k2a=k2 crosses over 1k2b=k2 crosses under 1upmajoron = j > 1 and ja[1]upmajoroff = j < 1 and jb[1]upminoron = j2 > 1 and j2a[1]upminoroff = j2 < 1 and j2b[1]dnmajoron = j < -1 and jc[1]dnmajoroff = j > -1 and jd[1]dnminoron = k2 > 1 and k2a[1]dnminoroff = k2 < 1 and k2b[1]if ground>1 thenupmid=1drawtext("●",barindex,high+tr*0.35)coloured("lime",255*trind)elseupmid=0drawtext("●",barindex,high+tr*0.35)coloured("yellow",255*trind)endifif sky>1 thendnimd=1elsednimd=0endifif j>1 thenupmajor=1drawtext("▼",barindex,high+tr*0.35)coloured("lime",255*trind)elsif j<-1 thenupmajor=-1drawtext("▼",barindex,high+tr*0.35)coloured("red",255*trind)elseupmajor=0drawtext("▼",barindex,high+tr*0.35)coloured("yellow",255*trind)endifif j2>1 thenupminor=1drawtext("◼︎",barindex,high+tr*0.35)coloured("lime",255*trind)elseupminor=-1drawtext("◼︎",barindex,high+tr*0.35)coloured("red",255*trind)endifif k2>1 thendnminor=1elsednminor=-1endif//------------------------------------------------------//// Slope Calculation//------------------------------------------------------//src=average[5](close)// Long term trendlts=LinearRegression[40](src)ltsprev=LinearRegression[40](close[3])ltsslope=(lts-ltsprev)/3// Medium term trendmts=LinearRegression[20](src)mtsprev=LinearRegression[20](close[3])mtsslope=(mts-mtsprev)/3// Short term trendsts=LinearRegression[3](src)stsprev=LinearRegression[3](close[1])stsslope=(sts-stsprev)/2tls=stsslope//------------------------------------------------------//// VSA signal generation//------------------------------------------------------////WRB and UHS in midterm trendupThrustBar=wideRangeBar and downClose and high > high[1] and upmid=1// NEW SIGNAL - Upthrust after new short up movenut=wideRangeBar and downClose and freshGndHi and highVolume// Buying Climaxbc=wideRangeBar and aboveClose and volume = highest[60](volume) and upmajor=1// after minor up trendupThrustBar1 = wideRangeBar and (ClosePos=1 or ClosePos=2) and upminor>0 and High>High[1] and (upmid>0 or upmajor>0) and volpos < 4// occurs after a major uptrendupThrustBartrue = wideRangeBar and ClosePos=1 and upmajor>0 and High>High[1] and volpos < 4// The Bar after Upthrust Bar- Confirms weaknessupThrustCond1 = upThrustBar[1] and downBar and not narrowRangeBar// The Bar after Upthrust Bar- Confirms weaknessupThrustCond2 = upThrustBar[1] and downBar and Volume>(volAvg*1.3)// ReviewupThrustCond3 = upThrustBar and Volume>(volAvg*2)// Top Reversal bartopRevBar = Volume[1]>volAvg and upBar[1] and wideRangeBar[1] and downBar and downClose and wideRangeBar and upmajor>0 and High=highest[10](High)PseudoUpThrust = (upBar[1])and High>High[1] and Volume[1]>1.5*volAvg and downBar and downClose and not upThrustBarpseudoUtCond = PseudoUpThrust[1] and downBar and downClose and not upThrustBartrendChange = upBar[1] and High=highest[5](High) and downBar and (downClose or midClose) and Volume>volAvg and upmajor>0 and upmid>0 and not wideRangeBar and not PseudoUpThrust//in a up marketnoDemandBarUt = upBar and narrowRangeBar and lowVolume and (aboveClose or upClose) and ((upminor>=0 and upmid>=0) or (upminor<=0 and upminor>=0))// in a down or sidewayss marketnoDemandBarDt = upBar and narrowRangeBar and lowVolume and (aboveClose or upClose) and (upminor<=0 or upmid<=0)noSupplyBar = downBar and narrowRangeBar and lowVolume and midCloselowVolTest = low = lowest[5](low) and upClose and lowVolumelowVolTest1 = low = lowest[5](low) and Volume<volAvg and Low<Low[1] and upClose and upminor>0 and upmajor>0lowVolTest2 = lowVolTest[1] and upBar and upClosesellCond1 = (upThrustCond1 or upThrustCond2 or upThrustCond3)sellCond2 = sellCond1[1]=0sellCond = sellCond1 and sellCond2strengthDown0 = upmajor<0 and volpos < 4 and downBar[1] and upBar and ClosePos>3 and upminor <0 and upmid <=0// Strength after a down trendstrengthDown = volpos<4 and downBar[1] and upBar and ClosePos>3 and upmid<=00 and upminor<0strengthDown1 = upmajor<0 and Volume>(volAvg*1.5) and downBar[1] and upBar and ClosePos>3 and upmid<=0 and upminor<0strengthDown2 = upmid<=0 and Volume[1]<volAvg and upBar and veryHighClose and volpos<4buyCond1 = strengthDown or strengthDown1buyCond = upBar and buyCond1[1]stopVolume = Low=lowest[5](Low) and (upClose or midClose) and Volume>1.5*volAvg and upmajor<0revUpThrust = upBar and upClose and Volume>Volume[1] and Volume>volAvg and wideRangeBar and downBar[1] and downClose[1] and upminor<0effortUp =High>High[1] and Low>Low[1] and Close>Close[1] and Close>=((High-Low)*0.7+Low) and spread>avgSpread and volpos<4effortUpfail = effortUp[1] and (upThrustBar or upThrustCond1 or upThrustCond2 or upThrustCond3 or (downBar and AvgSpreadBar))effortDown =High<High[1] and Low<Low[1] and Close<Close[1] and Close<=((High-Low)*0.25+Low) and wideRangeBar and Volume>Volume[1]effortDownFail = effortDown[1] and ((upBar and AvgSpreadBar) or revUpThrust or buyCond1)upflag = (sellCond or buyCond or effortUp or effortUpfail or stopVolume or effortDown or effortDownFail or revUpThrust or noDemandBarDt or noDemandBarUt or noSupplyBar or lowVolTest or lowVolTest1 or lowVolTest2 or bc)bullBar = (Volume>volAvg or Volume>Volume[1]) and Close<=((spread*0.2)+Low) and upBar and not upflagbearBar = vb and downClose and downBar and spread>avgSpread and not upflag//------------------------------------------------------//// Plot Shapes Section//------------------------------------------------------//if (upThrustBar or upThrustBartrue) and not effortUpfail and not sellCond and not bc thendrawtext("▼",barindex,high+tr*0.35)coloured("darkred")endifUT1 = upThrustBar or upThrustBartrueif(upThrustCond1 or upThrustCond2 or nut)and not effortUpfail and not sellCond and not bc thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endifUT2 = upThrustCond1 or upThrustCond2UT = UT1 or UT2//if topRevBar and not sellCond and not UT and not effortUpfail thendrawtext("▼",barindex,high+tr*0.35)coloured("orange")endif// TCif trendChange and not effortUpfail thendrawtext("▼",barindex,high+tr*0.35)coloured(255,71,26)endif// PUTif PseudoUpThrust and not effortUpfail thendrawtext("▼",barindex,high+tr*0.35)coloured(255,71,26)endif// PUCif pseudoUtCond and not effortUpfail thendrawtext("▼",barindex,high+tr*0.35)coloured(255,71,26)endif// NDif noDemandBarUt thendrawtext("︎●",barindex,high+tr*0.35)coloured(255,71,26)endifif noDemandBarDt thendrawtext("︎●",barindex,high+tr*0.35)coloured(255,71,26)endif//NSif noSupplyBar thendrawtext("︎●",barindex,low-tr*0.35)coloured("lime")endif// LVTif lowVolTest and not effortDownFail thendrawtext("︎●",barindex,low-tr*0.35)coloured("lime")endif//STif lowVolTest2 and not effortUp thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endiflvt = lowVolTest or lowVolTest2//-------------------------------------------------------//EFD = effortDownFailST1 = strengthDown0ST2 = strengthDown and not strengthDown2strcond = strengthDown2 and not strengthDown0 and not strengthDown and not strengthDown1ST3 = strengthDown1ST4 = strengthDown2 and strcondST5 = strengthDown2 and not strcondST = ST1 or ST2 or ST3 or ST4 or ST5//ST1if strengthDown0 and not EFD and not effortUp and not stopVolume thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//ST2if strengthDown and not strengthDown2 and not EFD and not effortUp and not stopVolume thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//ST3if strengthDown1 and not EFD and not effortUp and not stopVolume thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//st4if strengthDown2 and strcond and not EFD and not effortUp and not stopVolume thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//------------------------------------------------------//// SVif stopVolume and not ST thendrawtext("︎●",barindex,low-tr*0.35)coloured("lime")endif// ST\nSVif stopVolume and ST thendrawtext("︎●",barindex,low-tr*0.35)coloured("lime")endif// EUif effortUp and not ST and not buyCond and not effortDownFail thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endifif effortUp and ST and not buyCond thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif// EUfif effortUp and ST and not buyCond thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endif//EDif effortDown and not effortUpfail thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endif//EDFif effortDownFail and not ST thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endifif effortDownFail and ST thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//RUTif revUpThrust and not ST thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//BYC1if buyCond and not ST and not effortUp and not lvt thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//BYC3if buyCond and not ST and effortUp thendrawtext("▲",barindex,low-tr*0.35)coloured("lime")endif//SECif sellCond and UT thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endif//BCif bc and not UT thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endif//BC UT\nBCif bc and UT thendrawtext("▼",barindex,high+tr*0.35)coloured("red")endif//------------------------------------------------------//// BAR COLORING CODE//------------------------------------------------------//Vrg=average[30](volume)// average volumerg=(high-close)arg=average[30,2](rg)Vh=volume>volume[1] and volume[1]>volume[2]Cloc=close-lowx=(high-low)/Clocif Cloc=0 thenx1=argelsex1=xendifVb1 = volume >Vrg or volume > volume[1]ucls=x1<2dcls=x1>2mcls=x1<2.2 and x1>1.8Vlcls=x1>4Vhcls=x1<1.35upbar = close > close[1]dnbar = close < close[1]CloseUp = close > close[1]CloseDn = close < close[1]VolUp = volume > volume[1]VolDn = volume < volume[1]bb1 = upbar and CloseUp and ucls and low > low[1]bb2 = upbar and VolUpbb3 = dnbar and CloseDn and VolDnbb4 = dnbar and CloseDn and close > close[1]db1 = dnbar and CloseDn and dclsdb2 = dnbar and VolUpdb3 = upbar and CloseDn and VolUpdb4 = upbar and CloseDn and close<low[1] and dclsdb5 = upbar and CloseUp and ucls and low<low[1]db6 = upbar and CloseUp and dclsbb=(bb1 or bb2 or bb3 or bb4)db=(db1 or db2 or db3 or db4 or db5 or db6)//neucolor = bkbg == true ? color.white : color.blueif bb and tls>0 thenr=0g=255b=0elsif db and tls<0 thenr=255g=0b=0elsif bkbg thenr=255g=255b=255elser=0g=0b=255endifif bkbg thenbackgroundcolor("black")endifdrawcandle(open, high, low, close)coloured(r,g,b)//------------------------------------------------------//return sma50 as "MA50" coloured("blue"), sma200 as "MA200" coloured("red")01/31/2025 at 12:49 PM #243263Thanks a lot Ivan – amazing – only question do you know if it is possible to have a “cheat sheet ” to know the definition of the signal to know separately the symbol which corresponds to the definition?
in TradingView they have below or above the symbol acronyms like EDF/SV but in my opinion no need as chart becomes too heavy – but just to know what symbol means what separately & one can keep it at hand?
Best
Fred
examples
EDF – Effort to Move Down Failed: Widespread / above average spread Bar closing up on High volume or above average volume appearing after ‘Effort to move down” bar.
This indicates that the Effort to move the pries down has failed. Bullish signalSV – Stopping Volume: A high volume medium to widespread Bar closing in the upper middle part in a down trend indicates that smart money is buying. This is an indication that the down trend is likely to end soon. Indicates strength
01/31/2025 at 3:34 PM #243283Hi, Of course, you would have to add an extra line on each line. Here is an example:
12345//BCif bc and not UT thendrawtext("▼",barindex,high+tr*0.35)coloured("red")drawtext("BC",barindex,high+tr*0.45)coloured("red")endifYou will have to test the value to multiply by
tr
so that it looks good visually. I'll leave that up to you 🙂 -
AuthorPosts
Find exclusive trading pro-tools on