Purple Cloud indicator
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Purple Cloud indicator
- This topic has 2 replies, 2 voices, and was last updated 3 months ago by Stenozar.
-
-
09/08/2024 at 9:59 PM #237327
Buonasera,
sarebbe possibile tradurre questo codice di un indicatore che sembra interessante?
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © muratm82//@version=5
indicator(“Purple Cloud [MMD]”,overlay=true, timeframe=””, timeframe_gaps=true)atrPeriod = input(10, “Supertrend ATR Length”)
factor = input.float(3.0, “Supertrend Factor”, step = 0.01)[supertrend, direction] = ta.supertrend(factor, atrPeriod)
x1 = input(14, “Period”)
alpha = input.float(0.7, “Alpha”, step = 0.1)bpt=input.float(1.4,”Buying Pressure Threshold %”, step = 0.1)
spt=input.float(1.4,”Selling Pressure Threshold %”, step = 0.1)x2 = ta.atr(x1) * alpha
xh = close + x2
xl = close – x2
a1=ta.vwma(hl2*volume,math.ceil(x1/4))/ta.vwma(volume,math.ceil(x1/4))
a2=ta.vwma(hl2*volume,math.ceil(x1/2))/ta.vwma(volume,math.ceil(x1/2))
a3=2*a1-a2
a4=ta.vwma(a3,x1)b1 = 0.0
b1 := na(b1[1]) ? ta.sma(close, x1) : (b1[1] * (x1 – 1) + close) / x1a5=2*a4*b1/(a4+b1)
buy = a5<=xl and close>b1*(1+bpt*0.01)
sell = a5>=xh and close<b1*(1-spt*0.01)
xs = 0
xs := buy ? 1 : sell ? -1 : xs[1]barcolor( color = xs==1 ? color.green :xs==-1? color.red:na)
plotshape(buy and xs != xs[1] , title = “BUY”, text = ‘B’, style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1] , title = “SELL”, text = ‘S’, style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, size = size.tiny)plotshape(buy and xs != xs[1] and direction < 0 , title = “Strong BUY”, text = ‘🚀’, style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1] and direction > 0 , title = “Strong SELL”, text = ‘☄️’, style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, size = size.tiny)ema200=input(false,”Ema 200″)
ema50=input(false,”Ema 50″)
ema20=input(false,”Ema 20″)plot(ta.ema(close,200),color=ema200?color.black:na,title=”Ema 200″,linewidth = 4)
plot(ta.ema(close,50),color=ema50?color.blue:na,title=”EMA 50″,linewidth = 3)
plot(ta.ema(close,20),color=ema20?color.orange:na,title=”EMA 20″,linewidth = 2)
alertcondition(buy and xs != xs[1], “PC Long”, “PC Long”)
alertcondition(sell and xs != xs[1], “PC Short”, “PC Short”)Grazie
09/09/2024 at 12:56 PM #237359Ciao. Eccolo qui: https://www.prorealcode.com/prorealtime-indicators/purple-cloud-indicator/
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697//-----------------------------------------------------////-----Inputs------------------------------------------////-----------------------------------------------------//atrperiod=10 //SuperTrend ATR lengthfactor=3 //Supertrend factorx1=14alpha=0.7bpt=1.4//Buying Pressure Threshold %spt=1.4//Selling Pressure Threshold %drawsupertrend=1 //Draw Supertrenddrawemas=1 //Draw EMAscolorcandles=1 //Color candlesdrawsignals=1 //Draw Signals//-----------------------------------------------------////-----SuperTrend--------------------------------------////-----------------------------------------------------//St=Supertrend[factor,atrperiod]//-----------------------------------------------------////-----Up and Down Bands-------------------------------////-----------------------------------------------------//x2=averagetruerange[x1](close)*alphaxh=close+x2xl=close-x2a1=VolumeAdjustedAverage[floor(x1/4)]((high+low)/2*volume)/VolumeAdjustedAverage[floor(x1/4)](volume)a2=VolumeAdjustedAverage[floor(x1/2)]((high+low)/2*volume)/VolumeAdjustedAverage[floor(x1/2)](volume)a3=2*a1-a2a4=VolumeAdjustedAverage[x1](a3)if barindex < x1 thenb1=average[x1](close)elseb1=(b1[1]*(x1-1)+close)/x1endifa5=2*a4*b1/(a4+b1)//-----------------------------------------------------////-----Buy and Sell Signals----------------------------////-----------------------------------------------------//buysignal=a5<=xl and close>b1*(1+bpt*0.01)sellsignal=a5>=xh and close<b1*(1-spt*0.01)if buysignal thenxs=1elsif sellsignal thenxs=-1elsexs=xs[1]endif//-----------------------------------------------------////-----Plot--------------------------------------------////-----------------------------------------------------////Color Candlesif xs=1 and colorcandles thendrawcandle(open,high,low,close)coloured("cyan",100)elsif xs=-1 and colorcandles thendrawcandle(open,high,low,close)coloured("fuchsia",100)endif//Plot Signalsif buysignal and xs<>xs[1] and close>st and drawsignals thendrawtext("STRONG BUY",barindex,low-tr)coloured("green")drawtext("▲",barindex,low-0.25*tr)coloured("green")elsif buysignal and xs<>xs[1] and drawsignals thendrawtext("BUY",barindex,low-tr)coloured("green")drawtext("▲",barindex,low-0.25*tr)coloured("green")elsif sellsignal and xs<>xs[1] and close<st and drawsignals thendrawtext("STRONG SELL",barindex,high+tr)coloured("red")drawtext("▼",barindex,high+0.25*tr)coloured("red")elsif sellsignal and xs<>xs[1] and drawsignals thendrawtext("SELL",barindex,high+tr)coloured("red")drawtext("▼",barindex,high+0.25*tr)coloured("red")endif//Plot EMAsif drawemas thenema200=average[200,1](close)ema50=average[50,1](close)ema20=average[20,1](close)elseema200=undefinedema50=undefinedema20=undefinedendif//Plot Supertrendif drawsupertrend and close>st thensuperT=str=0g=255elsif drawsupertrend and close<=st thensuperT=str=255g=0elsesuperT=undefinedendif//-----------------------------------------------------//return superT as "SuperTrend"coloured(r,g,0)style(line,3),ema200 as "EMA 200" style(line,4),ema50 as "EMA 50" style(line,3)coloured("lightblue"),ema20 as "EMA 20" style(line,2)coloured("orange")09/11/2024 at 8:58 PM #237518 -
AuthorPosts
Find exclusive trading pro-tools on