Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study(" MultiTrendmeter", overlay=false)
- //___________________________________________________________________________________________________________
- ///DMI INDICATOR///
- adxlen = (14)
- dilen = (14)
- dirmov(len) =>
- up = change(high)
- down = -change(low)
- truerange = rma(tr, len)
- plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
- minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
- [plus, minus]
- adx(dilen, adxlen) =>
- [plus, minus] = dirmov(dilen)
- sum = plus + minus
- adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
- [adx, plus, minus]
- [sig, up, down] = adx(dilen, adxlen)
- plus1 = up > down
- minus1 = up < down
- adx1 = sig > 20
- adx2 = sig > 50
- //_______________________________________________________________________________________________________________
- ///VI INDICATOR///
- period_ = (14)
- VMP = sum( abs( high - low[1]), period_ )
- VMM = sum( abs( low - high[1]), period_ )
- STR = sum( atr(1), period_ )
- VIP = VMP / STR
- VIM = VMM / STR
- //_______________________________________________________________________________________________________________
- ///OBV+SMMA///
- src=close
- obv = cum(sign(change(src)) * volume)
- len = (100)
- //src1 = input(obv, title="Source")
- smma = 0.0
- smma := na(smma[1]) ? sma(obv, len) : (smma[1] * (len - 1) + obv) / len
- //plot(smma, color=color.red)
- //plot(obv)
- //__________________________________________________________________________________________________________________
- ///SIGNALS///
- signal1 = up > down ? color.lime : na
- signal2 = up < down ? color.orange : na
- signal3 = VIP > VIM ? color.green : VIP < VIM ? color.red :na
- signal4 = obv > smma ? color.green : obv < smma ? color.red :na
- signal5 = plus1 and adx1 ? color.teal : na
- signal6 = plus1 and adx2 ? color.green : na
- signal7 = minus1 and adx1 ? color.red : na
- signal8 = minus1 and adx2 ? color.maroon : na
- ///PLOTS///
- //______________________________________________________________________________________________________________________
- plot( 5, color=signal7, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 5, color=signal8, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 5, color=signal5, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 5, color=signal6, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 5, color=signal1, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 5, color=signal2, style=plot.style_columns, title="1st line", linewidth=2, histbase=4)
- plot( 3, color=signal3, style=plot.style_columns, title="2nd line", linewidth=2, histbase=2)
- plot( 1, color=signal4, style=plot.style_columns, title="3rd line", linewidth=2, histbase=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement