//@version=2 study(title="RISING ZION", overlay=true) // 🔹 **User Inputs for Three ATRs** atrPeriod1 = input(14, title="ATR Period 1") atrMultip1 = input(2, title="ATR Multiplier 1") atrPeriod2 = input(10, title="ATR Period 2") atrMultip2 = input(3, title="ATR Multiplier 2") atrPeriod3 = input(26, title="ATR Period 3") atrMultip3 = input(9, title="ATR Multiplier 3") // 🔹 **Calculate ATR Values** atr1 = atr(atrPeriod1) atr2 = atr(atrPeriod2) atr3 = atr(atrPeriod3) loss1 = atrMultip1 * atr1 loss2 = atrMultip2 * atr2 loss3 = atrMultip3 * atr3 // 🔹 **Trailing Stop Logic for Each ATR** atrTrailingStop1 = na atrTrailingStop1 := close > nz(atrTrailingStop1[1]) and close[1] > nz(atrTrailingStop1[1]) ? max(nz(atrTrailingStop1[1]), close - loss1) : close < nz(atrTrailingStop1[1]) and close[1] < nz(atrTrailingStop1[1]) ? min(nz(atrTrailingStop1[1]), close + loss1) : close > nz(atrTrailingStop1[1]) ? close - loss1 : close + loss1 atrTrailingStop2 = na atrTrailingStop2 := close > nz(atrTrailingStop2[1]) and close[1] > nz(atrTrailingStop2[1]) ? max(nz(atrTrailingStop2[1]), close - loss2) : close < nz(atrTrailingStop2[1]) and close[1] < nz(atrTrailingStop2[1]) ? min(nz(atrTrailingStop2[1]), close + loss2) : close > nz(atrTrailingStop2[1]) ? close - loss2 : close + loss2 atrTrailingStop3 = na atrTrailingStop3 := close > nz(atrTrailingStop3[1]) and close[1] > nz(atrTrailingStop3[1]) ? max(nz(atrTrailingStop3[1]), close - loss3) : close < nz(atrTrailingStop3[1]) and close[1] < nz(atrTrailingStop3[1]) ? min(nz(atrTrailingStop3[1]), close + loss3) : close > nz(atrTrailingStop3[1]) ? close - loss3 : close + loss3 // 🔹 **Plot ATR Trailing Stops** plot(atrTrailingStop1, color=blue, linewidth=2, title="ATR Stop 1") plot(atrTrailingStop2, color=green, linewidth=2, title="ATR Stop 2") plot(atrTrailingStop3, color=red, linewidth=2, title="ATR Stop 3") // 🔹 **Define Candle Color Condition** bullishCandle = close > atrTrailingStop1 and close > atrTrailingStop2 //and close > atrTrailingStop3 bearishCandle = close <= atrTrailingStop1 and close <= atrTrailingStop2 //or close <= atrTrailingStop3 // 🔹 **Plot ATR Trailing Stops** // 🔹 **Change Candle Color** barcolor(bullishCandle ? lime : bearishCandle ? red : na) //// // hline(OverSold,color=blue) // hline(OverBought,color=blue) // plot(k, color=black,title="k-line") // plot(d, color=fuchsia,title="d-line",linewidth=1) sma20 = sma(close, 20) sma40 = sma(close, 40) ema40 = ema(close,40) ema144 = ema (close,144) ema8 = ema(close,8) sma230=sma(close,230) sma1440=sma(close,1440) sma26=sma(close,26) //Bollinger Band settings below basis = sma(close,1144) dev2 = 2 * stdev(close,1144) upper2 = basis + dev2 lower2 = basis - dev2 //Average True Range Trailing Stops settings below changeSMA20 = change(sma20, 1) changeSMA40 = change(sma40, 1) slopeSMA20 = changeSMA20/1 slopeSMA40 = changeSMA40/1 rad2degree=180/3.14159265359 //pi slopeSMA20Degree = rad2degree*atan(slopeSMA20) slopeSMA40Degree = rad2degree*atan(slopeSMA40) iSMA20 = 20 iBarsBack=input(defval=2,title="Bars Back",type=integer) hline(0) sma2sample=sma(close,iSMA20) slopeD20=rad2degree*atan((sma2sample[1]-nz(sma2sample[iBarsBack]))/iBarsBack) iSMA40 = 40 hline(0) sma2sample2=sma(close,iSMA40) slopeD40=rad2degree*atan((sma2sample2[1]-nz(sma2sample2[iBarsBack]))/iBarsBack) iSMA25 = input(defval=25,title="I SMA",type=integer) iSMA31 = input(defval=31,title="XTC Indicator",type=integer) iSMA16 = input(defval=16,title="B Series",type=integer) iSMA74 = input(defval=74,title="FoR Indicator",type=integer) cci5=cci(close, 20) cciCondition = if (cci5 <= -100 or cci5>=100) or (cci5[1] <= -100 or cci5[1]>=100) true else false touchConditionBottom1 = if (cross(close[1],sma40) and close[1]>=sma40) true else false touchConditionBottom2 = if (crossover(close,sma20) and close>=sma20) true else false smaSCondition = if sma20[1] >= sma40[1] and close>close[1] true else false slopeSMA20Condition = if slopeSMA20Degree > 0 true else false slopeSMA40Condition = if slopeSMA40Degree > 0 true else false cci55=cci(close, 5) cciCondition555 = cci55 + cci5 cciCondition55 = if (cci55[1] <= -99 or cci55[1]>=99) or (cci55 <= -100 or cci55>=100) true else false finalResult = cciCondition555 and touchConditionBottom1 and touchConditionBottom2 and smaSCondition and slopeSMA20Condition and slopeSMA40Condition and crossover(close,atrTrailingStop1) or crossover(close,atrTrailingStop2 ) x = if finalResult == true 1 else 0 // ************************* // final = finalResult and ((ema40<=high and ema40>=low) or (ema144<=high and ema144>=low)) y = if final == true 2 else 0 //alertcondition(y or z or w , title='PDP Alert', message='PUMP DETECTION PROGRAM') plot(x, title="BULLISH", color=green, linewidth=4) //plotshape(y, style= //plotarrow(y, colorup=teal, colordown=orange, transp=40) //plotchar(y, char='Emoji') //plotshape(y, style=shape.xcross) //plotarrow(y, colorup=teal, colordown=orange, transp=40)//plot(y, title="PDP line", color=yellow, linewidth=4) plotarrow(y,codiff, colorup=teal, colordown=orange, transp=40) plot(y, title="BULLISH", color=green, linewidth=4) alertcondition(y or x , title='PDP Alert', message='PUMP DETECTION PROGRAM') // Stochastic Based Relative Oversold and Overbought //Input // Short Stochastic Input length1 = input(8, minval=1, title = "Short %K") sma1 = input(3, minval=1, title="Smooth %K1") // Base Stochastic Input length3 = input(100, minval=1, title = "Base %K") sma3 = input(10, minval=1, title="Smooth %K3") // Stochastic Code k1 = (sma(stoch(close, high, low, length1), sma1)-50) k3 = (sma(stoch(close, high, low, length3), sma3)-50) //Histogram 1 Calc and Plot hist1 = (k1-k3) plot_color1 = hist1 > hist1[1] and hist1 > 0 ? green : hist1 < hist1[1] and hist1 > 0 ? blue : hist1 < hist1[1] and hist1 <= 0 ? red : hist1 > hist1[1] and hist1 <= 0 ? orange : white plot(hist1, color=plot_color1, style=histogram, linewidth=4, title="Diff") //Horizontal Lines h1=hline(80, "Extreme Up", red, solid, 3) h2=hline(-80, "Extreme Down", green, solid, 3) h3=hline(55, "OverBought", red, dashed, 1) h4=hline(-55, "OverSold", green, dashed, 1) fill(h2,h4, green, 80, "OverSold Zone") fill(h1,h3, red, 80, "OverBought Zone") //Code for Trend Based Zero Line ma1 = ema(close, 13) ma2 = ema(close, 21) ma3 = ema(close, 34) ma = ema(close, 89) range = tr rangema = ema(range, 89) upper = ma + rangema * 0.5 lower = ma - rangema * 0.5 tr_up = ma1 > upper and ma2 > upper and ma3 > upper tr_down = ma1 < lower and ma2 < lower and ma3 < lower scolor = tr_up ? green : tr_down ? red : blue plot(0, color=scolor, style=circles, linewidth=3) body=abs(open-close) us= openbody*2) data= us < body*0.1 and ls>body*2 plotshape(data, text='HM')