PLEASE CON VERT vSI VOL X FROM TRADDING VIEW
Forums › ProRealTime English forum › ProBuilder support › PLEASE CON VERT vSI VOL X FROM TRADDING VIEW
- This topic has 7 replies, 3 voices, and was last updated 1 month ago by
Patrick K Templar.
-
-
02/19/2025 at 9:02 PM #244079VSI TRADDIG VIEW12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182// VSI-Input ======================================================================================= //length = input.int(13, minval=1, title='Length')// Relative Strength application on Volume IndicatorsaddRsiX = input.string('On Balance Volume', '► Relative Strength of', options=['Accumulation/Distribution', 'Elders Force Index', 'Money Flow Index', 'On Balance Volume', 'Price Volume Trend'])smooth = input.int(2, 'Smooth RSI, with Least Squares Method', minval=2)// Volume Histogramgroup_hist='Relative Volume Histogram'tp_rvol = 'Relative Volume (RVOL) compares current volume levels to average volume levels over a specified look-back period. \nRVOL = CurrentVolume / AverageVolume'volHist = input.string('Relative Volume [4 Color]', '► Relative Volume Histogram', options=['Relative Volume', 'Relative Volume [4 Color]', 'Buying/Selling Volume [1]', 'Buying/Selling Volume [2]', 'None'], group = group_hist, tooltip = tp_rvol)volComp = input.string('Volume Oscillator', '► Histogram Companion', options=['Moving Average', 'Volume Oscillator', 'None'], group = group_hist)size = input(10, 'Histogram Size', group = group_hist)// Volume Based Colored Barsvbcb = input(true, title='► Volume Weighted Colored Bars', group='Volume Weighted Colored Bars', tooltip='Colors bars based on the bar\'s volume relative to volume moving average')// -Calculation ================================================================================= //nzVolume = nz(volume)O = open, H = high, L = low, C = close// RSIrsi = ta.rsi(C, length)srsi = ta.linreg(rsi, smooth, 0)float rsix = switch addRsiX'Accumulation/Distribution' => ta.rsi(ta.cum(C == H and C == L or H == L ? 0 : (2 * C - L - H) / (H - L) * nzVolume), length)'Elders Force Index' => ta.rsi(ta.ema(ta.change(C) * nzVolume, length), length)'Money Flow Index' => 100.0 - 100.0 / (1.0 + math.sum(nzVolume * (ta.change(hlc3) <= 0 ? 0 : hlc3), length) / math.sum(nzVolume * (ta.change(hlc3) >= 0 ? 0 : hlc3), length))'On Balance Volume' => ta.rsi(ta.cum(math.sign(ta.change(C)) * nzVolume), length)'Price Volume Trend' => ta.rsi(ta.cum(ta.change(C) / C[1] * nzVolume), length)srsix = ta.linreg(rsix, smooth, 0)// Volume HistogramvAvg = ta.sma(nzVolume, length)rvAvg = ta.sma(nzVolume / vAvg * size, length)B = nzVolume * (C - L) / (H - L) / vAvg * sizeS = nzVolume * (H - C) / (H - L) / vAvg * size// Histogram Companionvolx = switch volComp'Moving Average' => rvAvg//ta.sma(nzVolume / vAvg * size, length)'Volume Oscillator' => (ta.ema(nzVolume, 5) - ta.ema(nzVolume, 10)) / ta.ema(nzVolume, 10) * 100// -Plot ======================================================================================== //// Volume Histogramplot(nzVolume and volHist == 'Relative Volume' ? nzVolume / vAvg * size : na, 'Volume, normalized to fit the Scale',O > C ? color.new(#ef5350, 0) : color.new(#26a69a, 0), style=plot.style_columns, editable=false)plot(nzVolume and volHist == 'Relative Volume [4 Color]' ? nzVolume / vAvg * size : na, 'Volume, normalized to fit the Scale',O > C ? nzVolume / vAvg * math.abs(size) > math.abs(rvAvg) ? color.new(#ef5350, 0) : color.new(color.gray, 25) :nzVolume / vAvg * math.abs(size) > math.abs(rvAvg) ? color.new(#26a69a, 0) : color.new(color.gray, 55), style=plot.style_columns, editable=false)plot(nzVolume and (volHist == 'Buying/Selling Volume [1]' or volHist == 'Buying/Selling Volume [2]') ? volHist == 'Buying/Selling Volume [1]' ? S + B : B : na, 'Total/Buying Volume' , color.new(#26a69a, 0) , style=plot.style_columns, editable=false)plot(nzVolume and (volHist == 'Buying/Selling Volume [1]' or volHist == 'Buying/Selling Volume [2]') ? volHist == 'Buying/Selling Volume [1]' ? S : -S : na, 'Selling Volume' , color.new(#ef5350, 0) , style=plot.style_columns, editable=false)// Histogram Companionplot(nzVolume and volHist != 'None' ? volx : na, 'Volume MA/OCS', color.orange, 2)// Threshold Linesp1 = hline(75, color=color.red, title='Overbought Higher Theshold Level', linestyle=hline.style_dotted)p2 = hline(65, color=color.red, title='Overbought Lower Theshold Level' , linestyle=hline.style_dotted)fill(p1, p2, color=color.new(color.red, 89), title='Overbought Background')hline(50, color=color.gray, title='Middle Line (Bull/Bear Border Line)', linestyle=hline.style_dotted, linewidth=2)p3 = hline(35, color=color.green, title='Oversold Higher Theshold Level', linestyle=hline.style_dotted)p4 = hline(25, color=color.green, title='Oversold Lower Theshold Level' , linestyle=hline.style_dotted)fill(p3, p4, color=color.new(color.green, 89), title='Oversold Background')// VSIplot(srsi, 'Relative Strength of Price', #8E1599, 2)plot(nzVolume ? srsix : na, 'Relative Strength of Volume X', color.aqua, 2)// Volume Based Colored Bars by KIVANÇ ÖZBİLGİÇbarcolor(vbcb and nzVolume ? nzVolume > vAvg * 1.618 ? C > O ? #006400 : #910000 : nzVolume < vAvg * 0.618 ? C > O ? #7FFFD4 : #FF9800 : C > O ? color.green : color.red : na, title='Volume Weighted Colored Bars', editable=false)var table logo = table.new(position.bottom_right, 1, 1)if barstate.islasttable.cell(logo, 0, 0, '☼☾ ', text_size=size.normal, text_color=color.teal)
HELLO COULD PLESES CONVERT FROM TRADDING VIEW WITH THE OPTION SETTING THANNK YOU
02/19/2025 at 9:19 PM #244081COULD PLES MAKE SURE it has the setting setup with in plz here are pitcures of the setting thannk you THANNK YOU
02/20/2025 at 4:30 PM #244106I HAVER ETRROS on my try
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051DEFPARAM PRELOADBARS = 150length = 13smooth = 2histogramSize = 10// Compute standard RSI on pricersiPrice = RSI[close, length]smoothRsiPrice = LinearRegression[rsiPrice, smooth]// Compute On Balance Volume (OBV) for volume-based RSIobv = SUM(IF close > close[1] THEN volume ELSE IF close < close[1] THEN -volume ELSE 0 ENDIF, length)volIndicator = RSI[obv, length]smoothVolIndicator = LinearRegression[volIndicator, smooth]// Compute relative volumevolAvg = Average[volume, length]relativeVolume = (volume / volAvg) * histogramSizevolOscillator = (ExponentialAverage[volume, 5] - ExponentialAverage[volume, 10]) / ExponentialAverage[volume, 10] * 100// Overbought/Oversold zonesdrawhline(75, "Overbought", red, linestyle = 1)drawhline(65, "Overbought", red, linestyle = 1)drawhline(50, "Neutral", grey, linestyle = 0)drawhline(35, "Oversold", green, linestyle = 1)drawhline(25, "Oversold", green, linestyle = 1)// Plot RSI linesRETURN smoothRsiPrice AS "Price RSI", smoothVolIndicator AS "Volume RSI"// Plot volume histogramIF relativeVolume > histogramSize THENhistColor = blueELSIF relativeVolume < histogramSize * 0.618 THENhistColor = orangeELSEhistColor = greyENDIFHISTOGRAM relativeVolume AS "Relative Volume" COLOURED(histColor)// Volume oscillator plotRETURN volOscillator AS "Volume Oscillator", orange// Colored bars based on volumeIF volume > volAvg * 1.618 THENbarColor = darkgreenELSIF volume < volAvg * 0.618 THENbarColor = lightblueELSEbarColor = greyENDIFCOLOURED BAR barColor02/20/2025 at 8:43 PM #244116After the RETURN line there can’t be additional lines, unless they are comments.
02/20/2025 at 8:44 PM #244117But yours is not PRT code, as well.
02/20/2025 at 11:17 PM #244130im not very good at all at coding it hurts my brain but at least i give it a try
02/21/2025 at 10:15 AM #244133Hi! Here you have the code:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283//------------------------------------------------------//// Input//------------------------------------------------------//length=13 // LengthaddRsiX=1 // Relative Strength of 1=On Balance Volumesmooth=2 // Smooth RSIsize= 10 // Histogram sizevolComp=1 // Histogram companion 1=volume oscillator 0=Moving average//------------------------------------------------------//// RSI//------------------------------------------------------//myrsi=rsi[length](close)sRsi=LinearRegression[smooth](myrsi)if addRsiX=1 thenif close=close[1] thensrc=0elsif close>close[1] thensrc=volumeelsif close<close[1] thensrc=-volumeendifCumSrc=cumsum(src)rsix=rsi[length](CumSrc)endifsRsix=LinearRegression[smooth](rsix)//------------------------------------------------------//// Volume Histogram//------------------------------------------------------//vAvg=average[length](volume)rvAvg=average[length](volume*size/vAvg)B=volume*(close-low)/(high-low)/vAvg*sizeS=volume*(high-close)/(high-low)/vAvg*sizeif volComp thenvolx=(average[5,1](volume)-average[10,1](volume))/average[10,1](volume)*100elsevolx=rvAvgendif//------------------------------------------------------//// Plot//------------------------------------------------------//volHist=volume/vAvg*sizeif open>close thenif volume/vAvg*abs(size)>abs(rvAvg) thenr=239g=83b=80a=255elser=120g=123b=134a=25endifelseif volume/vAvg*abs(size)>abs(rvAvg) thenr=36g=166b=154a=255elser=120g=123b=134a=55endifendif//------------------------------------------------------////Overbougthdrawhline(75)coloured("red")style(dottedline3)drawhline(65)coloured("red")style(dottedline3)colorbetween(75,65,"red",40)// Middledrawhline(50)coloured("grey")style(dottedline3)//OverSolddrawhline(35)coloured("green")style(dottedline3)drawhline(25)coloured("green")style(dottedline3)colorbetween(35,25,"green",40)//------------------------------------------------------//return volHist coloured(r,g,b,a)style(histogram), rvavg coloured("orange"), srsi as "Relative Strength of price" coloured(142,21,153)style(line,2), srsix as "Relative Strength of Volume" coloured(0,188,212)style(line,2)2 users thanked author for this post.
02/26/2025 at 2:29 PM #244377THANNK YOU
Hello could you kindly just help me with some more settings I’ve showed some photos is due to with the options on the trading view version what makes it very easy to switch between things I’d also like to know how to code this in for future indicators as well so it would be a great place to have a template to go back to as well as I show you the images that you understand basically I think one of the turning the volume into more of an oscillation and I can’t yeah on both the bars and the movering average that goes across I think
-
AuthorPosts
Find exclusive trading pro-tools on