TradingView
MrBetonBlocks
2020年12月21日午後1時6分

MrBS:Directional Movement Index [Trend Friend] 

Bitcoin / TetherUSBinance

詳細

I started this project with the goal of making a DMI/ADX that was easy to read at a glance. Its since become a little more then just colouring the slopes. The majority of the time, the best returns come from trending markets (THE TREND IS YOUR FRIEND... until the end) and I hope this helps people become good friends with the trends.

----- Features

- A function to change the values used for calculation from real OHLC and Heikin Ashi. This allows us to look at different chart types but see the specific ADX we choose. Originally HA values were used for calculation since it is easier to see trend on HA charts. However when testing it was not as effective as the ADX calculated from the real values on normal charts. So the default function was flipped and real OHLC values are used as default.
- Two ADX plots so we can see two different smoothness's. With a smoothing of 2, a slight slow down in PA can cause a negative slope but the smoother ADX will stay trending unless its a major change. 2nd ADX is slightly transparent.
- There is an EMA of the main ADX that can be used as a exit signal filter. If the ADX starts going down but has not crossed the EMA we would stay in a trade.
- Plots (excluding EMA) are coloured based on positive or negative slopes.
- Fibonacci numbers have been used to create different trend levels, instead of the standard 25, 50, 100.
- Alerts for every useful situation to help save time and not have to manually enter levels or crosses each time.
- In the code there are 8 EMAs and 3 ADXs but it was too much so they have been slashed out, but are fully functional if you choose to activate and use them. To reactivate the 3rd ADX delete slashes on lines 50, 65, 78, 92-95, 165. The slashed out EMAs are much more obvious and easy to reactivate.


Colours:

ADX going up = Green
ADX going down = Red

DMI+ going up = Bright Aqua
DMI+ going down = Turquoise / Dark Aqua

DMI- going up = Bright Purple
DMI- going down = Dark Purple

EMA = White (50% transparent)



If there is anything that would be useful, let me know and I will add it in. I've already got some improvements/changes planned and some of my notes can be found in the code.

There is also a strategy to go with this indicator that will be uploaded very soon.

リリースノート

Removed some of the notes from the code.

リリースノート

Changed transparency of 2nd ADX so its more visible.

リリースノート

Minor Update - Change of colours in advance of future update

リリースノート

another minor update

リリースノート

I've fixed the "turned up/down" alerts as they were triggering incorrectly. For some reason I set them up with the wrong lookback periods at first. Sorry to anyone who missed an opportunity due to this.

I've also changed my name, since I've taken almost all my money out of stonks and its all in different blockchain projects.
コメント
prepperwiki
I would pay a max respect for Fibonacci and script author, something I being looking for awhile, help me to remove bad trade of consolidating market time, this tool along if usingit right, its can be a Katana blade for someone arm into market especially the margin future one,
I'm a big fan of Fibonacci and every tool or method I use are way back to Fibonnaci only, author if you r active, please add friend and if we can can share more of things like this
by the way, I made some twist to the code, remove the EMA noise and keep the orgin colors for the best vision for action.

===================================

//@version=5
// MrBS:DMI+ [Trend Friend] - © MrBetonStonks (13/12/2020)

indicator(title='MrBB:Directional Movement Index [Trend Friend]', shorttitle='ADX + DMI Trendfriend', format=format.price, precision=4, timeframe='')

ticker = ticker.new(syminfo.prefix, syminfo.ticker)
realOpen = request.security(ticker, timeframe.period, open, lookahead=barmerge.lookahead_on)
realHigh = request.security(ticker, timeframe.period, high, lookahead=barmerge.lookahead_on)
realLow = request.security(ticker, timeframe.period, low, lookahead=barmerge.lookahead_on)
realClose = request.security(ticker, timeframe.period, close, lookahead=barmerge.lookahead_on)

//Heikin Ashi Values
haOpen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open, lookahead=barmerge.lookahead_on)
haHigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high, lookahead=barmerge.lookahead_on)
haLow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low, lookahead=barmerge.lookahead_on)
haClose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_on)

//Shared Inputs
len = input.int(14, minval=1, title='DI Length')
lenSig = input.int(4, minval=1, maxval=50, title='ADX Smoothing')
lenSig2 = input.int(14, minval=1, maxval=50, title='ADX2 Smoothing')
//lenSig3 = input(12, minval=1, maxval=50, title= "ADX3 Smoothing")
trendThres = input.float(22, step=0.1, title='Trend Threshold Level')
useHA = input(defval=false, title='Use Heikin Ashi values instead of Real OHLC')

//Real OHLC ADX calculation
up = ta.change(realHigh)
down = -ta.change(realLow)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
trur = ta.rma(math.max(realHigh - realLow, math.abs(realHigh - realClose[1]), math.abs(realLow - realClose[1])), len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig)
adx2 = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig2)
//adx3 = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig3)

//Heikin Ashi ADX calculation
haUp = ta.change(haHigh)
haDown = -ta.change(haLow)
haPlusDM = na(haUp) ? na : haUp > haDown and haUp > 0 ? haUp : 0
prepperwiki
@prepperwiki,

UPDATE v2:

//@version=5
// MrBS:DMI+ [Trend Friend] - © MrBetonStonks (13/12/2020)

indicator(title='MrBB:Directional Movement Index [Trend Friend]', shorttitle='ADX + DMI Trendfriend', format=format.price, precision=4, timeframe='')

ticker = ticker.new(syminfo.prefix, syminfo.ticker)
realOpen = request.security(ticker, timeframe.period, open, lookahead=barmerge.lookahead_on)
realHigh = request.security(ticker, timeframe.period, high, lookahead=barmerge.lookahead_on)
realLow = request.security(ticker, timeframe.period, low, lookahead=barmerge.lookahead_on)
realClose = request.security(ticker, timeframe.period, close, lookahead=barmerge.lookahead_on)

//Heikin Ashi Values
haOpen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open, lookahead=barmerge.lookahead_on)
haHigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high, lookahead=barmerge.lookahead_on)
haLow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low, lookahead=barmerge.lookahead_on)
haClose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_on)

//Shared Inputs
len = input.int(14, minval=1, title='DI Length')
lenSig = input.int(2, minval=1, maxval=50, title='ADX Smoothing')
lenSig2 = input.int(14, minval=1, maxval=50, title='ADX2 Smoothing')
//lenSig3 = input(12, minval=1, maxval=50, title= "ADX3 Smoothing")
trendThres = input.float(22, step=0.1, title='Trend Threshold Level')
useHA = input(defval=false, title='Use Heikin Ashi values instead of Real OHLC')

//Real OHLC ADX calculation
up = ta.change(realHigh)
down = -ta.change(realLow)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
trur = ta.rma(math.max(realHigh - realLow, math.abs(realHigh - realClose[1]), math.abs(realLow - realClose[1])), len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig)
adx2 = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig2)
//adx3 = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig3)

//Heikin Ashi ADX calculation
haUp = ta.change(haHigh)
haDown = -ta.change(haLow)
haPlusDM = na(haUp) ? na : haUp > haDown and haUp > 0 ? haUp : 0
haMinusDM = na(haDown) ? na : haDown > haUp and haDown > 0 ? haDown : 0
haTrur = ta.rma(math.max(haHigh - haLow, math.abs(haHigh - haClose[1]), math.abs(haLow - haClose[1])), len)
haPlus = fixnan(100 * ta.rma(haPlusDM, len) / haTrur)
haMinus = fixnan(100 * ta.rma(haMinusDM, len) / haTrur)
haSum = haPlus + haMinus
haAdx = 100 * ta.rma(math.abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig)
haAdx2 = 100 * ta.rma(math.abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig2)
//haAdx3 = 100 * rma(abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig3)

//// Calculation va
prepperwiki
@prepperwiki, UPDATE v3

//@version=5
// MrBS:DMI+ [Trend Friend] - © MrBetonStonks (13/12/2020)

indicator(title='MrBB:Directional Movement Index [Trend Friend]', shorttitle='ADX + DMI Trendfriend', format=format.price, precision=4, timeframe='')

ticker = ticker.new(syminfo.prefix, syminfo.ticker)
realOpen = request.security(ticker, timeframe.period, open, lookahead=barmerge.lookahead_on)
realHigh = request.security(ticker, timeframe.period, high, lookahead=barmerge.lookahead_on)
realLow = request.security(ticker, timeframe.period, low, lookahead=barmerge.lookahead_on)
realClose = request.security(ticker, timeframe.period, close, lookahead=barmerge.lookahead_on)

//Heikin Ashi Values
haOpen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open, lookahead=barmerge.lookahead_on)
haHigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high, lookahead=barmerge.lookahead_on)
haLow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low, lookahead=barmerge.lookahead_on)
haClose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_on)

//Shared Inputs
len = input.int(14, minval=1, title='DI Length')
lenSig = input.int(2, minval=1, maxval=50, title='ADX Smoothing')
lenSig2 = input.int(14, minval=1, maxval=50, title='ADX2 Smoothing')
//lenSig3 = input(12, minval=1, maxval=50, title= "ADX3 Smoothing")
trendThres = input.float(22, step=0.1, title='Trend Threshold Level')
useHA = input(defval=false, title='Use Heikin Ashi values instead of Real OHLC')

//Real OHLC ADX calculation
up = ta.change(realHigh)
down = -ta.change(realLow)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
trur = ta.rma(math.max(realHigh - realLow, math.abs(realHigh - realClose[1]), math.abs(realLow - realClose[1])), len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig)
adx2 = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig2)
//adx3 = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lenSig3)

//Heikin Ashi ADX calculation
haUp = ta.change(haHigh)
haDown = -ta.change(haLow)
haPlusDM = na(haUp) ? na : haUp > haDown and haUp > 0 ? haUp : 0
haMinusDM = na(haDown) ? na : haDown > haUp and haDown > 0 ? haDown : 0
haTrur = ta.rma(math.max(haHigh - haLow, math.abs(haHigh - haClose[1]), math.abs(haLow - haClose[1])), len)
haPlus = fixnan(100 * ta.rma(haPlusDM, len) / haTrur)
haMinus = fixnan(100 * ta.rma(haMinusDM, len) / haTrur)
haSum = haPlus + haMinus
haAdx = 100 * ta.rma(math.abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig)
haAdx2 = 100 * ta.rma(math.abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig2)
//haAdx3 = 100 * rma(abs(haPlus - haMinus) / (haSum == 0 ? 1 : haSum), lenSig3)

//// Calculation val
詳細