Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © rosentrader
- //@version=5
- indicator("TOTAL MTPI", overlay = true)
- RequestSecurityNRP(_tf, series float _exp) =>
- request.security(syminfo.tickerid, _tf, barstate.isconfirmed ? _exp : _exp[1])
- //Coral Trend
- srcCoral=RequestSecurityNRP("3D", close)
- sm =input.int(21, title="Smoothing Period")
- cd = input.float(0.4, title="Constant D")
- di = (sm - 1.0) / 2.0 + 1.0
- c1 = 2 / (di + 1.0)
- c2 = 1 - c1
- c3 = 3.0 * (cd * cd + cd * cd * cd)
- c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
- c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
- var float i1 = na
- var float i2 = na
- var float i3 = na
- var float i4 = na
- var float i5 = na
- var float i6 = na
- i1 := c1*srcCoral + c2*nz(i1[1])
- i2 := c1*i1 + c2*nz(i2[1])
- i3 := c1*i2 + c2*nz(i3[1])
- i4 := c1*i3 + c2*nz(i4[1])
- i5 := c1*i4 + c2*nz(i5[1])
- i6 := c1*i5 + c2*nz(i6[1])
- bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3)
- // --------------------------------------------------------------------------
- // For the Pinescript coders: Determining trend based on the mintick step.
- // --------------------------------------------------------------------------
- //bfrC = bfr - nz(bfr[1]) > syminfo.mintick ? green : bfr - nz(bfr[1]) < syminfo.mintick ? red : blue
- coralTrend = bfr > nz(bfr[1]) ? 1 : -1
- //RSI Momentum Trend
- var bool positive = false
- var bool negative = false
- string RSI_group = "RSI Settings"
- string mom_group = "Momentum Vales"
- string visual = "Visuals"
- int Len2 = input.int(14,"RSI 1️⃣",inline = "rsi",group = RSI_group)
- int pmom = input.int(60," Positive above",inline = "rsi1",group =RSI_group )
- int nmom = input.int(45,"Negative below",inline = "rsi1",group =RSI_group )
- rsiMomentumSource = RequestSecurityNRP("2D", close)
- rsi = ta.rsi(rsiMomentumSource, Len2)
- //------------------- }
- // ** ---> Momentums ------------- {
- p_mom = rsi[1] < pmom and rsi > pmom and rsi > nmom and ta.change(ta.ema(rsiMomentumSource,5)) > 0
- n_mom = rsi < nmom and ta.change(ta.ema(rsiMomentumSource,5)) < 0
- var rsiMomentumTrend = p_mom ? 1 : n_mom ? -1 : 0
- //AFR
- p = input.int(14, "Period")
- atr_factor = input.float(2.0, "Factor", step = 0.1)
- // Calculations
- atr = ta.atr(p)
- e = atr * atr_factor
- afr = close
- afr := nz(afr[1], afr)
- atr_factoryHigh = close + e
- atr_factoryLow = close - e
- if atr_factoryLow > afr
- afr := atr_factoryLow
- if atr_factoryHigh < afr
- afr := atr_factoryHigh
- afrTrend = afr > afr[1] ? 1 : -1
- afrTrend := afr == afr[1] ? afrTrend[1] : afrTrend
- colorCh = color.white
- if coralTrend == 1
- colorCh := color.green
- else
- colorCh := color.red
- barcolor(colorCh)
Advertisement
Comments
-
- download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment
Advertisement