TradingView
DovCaspi
18 กันยา 2014 เวลา 4 นาฬิกา 48 นาที

Accumulation/Distribution - with markers 

Apple Inc.NASDAQ

คำอธิบาย

Accumulation/Distribution - with markers
ความคิดเห็น
stanketa
What does markers represent, the end of cycles or buy and sell starting point? In example of gold in 1hr candle seems to be the start and the end of buying or accumulation process?
StephanePoirier
I would like to use your scrip but can you explane me how it work please?
UnknownUnicorn4547896
@StephanePoirier, I think the following is the underlying principle of this indicator: ad = cum( (((close - low) - (high - close)) / (high - low)) * volume ).
Tradotron2000
This indicator is a momentum oscillator of the traditional A/D indicator.

In the code "ad" is the line that you get in the traditional accumulation distribution indicator. This is not plotted here.
Instead he calculates a 9 and a 15 SMA of the A/D indicator and plots the difference (9 SMA - 15 SMA). In this sense it's the same type of logic as the MACD (without signal line).

When the A/D indicator goes up, the 9 SMA goes up faster than 15 SMA and the plotted line angles up, towards positive values. The higher it goes, the faster was the A/D move up.
When the A/D indicator goes down, the 9 SMA goes down faster than the 15 SMA and the plotted line angles down towards negative values. The lower it goes, the faster was the A/D move down.
The area below the plotted line basically tells you how fast and sustained (strong) the underlying A/D move up or down was. Which is smart because that's how the AD is used anyway:
If price goes up quickly and A/D goes up quickly = real move, backed by demand.
If price goes down quickly and A/D goes down quickly = real move, back by supply.
If the price moves quickly but the A/D moves slowly, or even moves in opposite direction = move is not backed by supply/demand and might be short lived (trend reversal or correction become likely).

That means you can play it mostly 2 ways (in my opinion):
- divergences: e.g. the price makes a higher high but the indicator makes a lower high ==> the price goes higher on less and less demand ==> exhaustion and reversal are probably close.
- slope of the line: a slope reversal will likely coincide with a price trend reversal (especially on extremes far from the zero line and especially on higher time frames).
==> I find that his indicator does not give good signals on very low time frames. It is better used on high time frames (daily and above) to call macro trend reversals.

He puts a maroon marker when the 9 crosses back below the 15.
In the code you can plot adCross which would put a green marker every time 9 and 15 cross (up or down).
I'm not sure what the markers are used for because the plotted line will cross 0 (and change color) every time 9 and 15 cross. Markers seem redundant.
You'll notice that markers and color changes sometimes happen sligthly below or above the 0 line. This is because the "perfect cross" with 9 SMA exactly = 15 SMA often happens in between periods (plotted points).
By deleting the // in front of the plot commands, you can see the traditional ad line as well as the 9 and 15 SMA. They won't be easy to see in one window however, as this indicator is centred around 0 and the traditional ad indicator often has very high values, you'll need to zoom out a lot.

Hope this helps who wanted to understand.
koalid
@Tradotron2000, Thanks for your comment. Very helpful. To me, the maroon point is really good to find bullish trend.
I use it a histogram and multiply it by x10
I call it the magic dot (or should I call it golden bar XD ?) :

plot(adMarker*10, title = "Accumulation/Distribution Magic Golden Dot", color=color(#e91e63), linewidth=3, style=plot.style_histogram)
NelsonM1984
@koalid, hey man, first - nice one putting the code in the comment! I kept it as is, but sure others will appreciate.

I'm interested in your use of the maroon point to find a bullish trend. I can see it confirming trends, but also coming in at some awful points (which, I know, use alongside other indicators!). If it occurs when the 9ma crosses below the 15ma, it actually signals incoming weakness, right? So when you are seeing bullish, it's actually saying "watch out, this trend is ending soon!" ?

I've wondered as well about the colour of the line, if there's a more intuitive way to have it coloured. Will keep thinking.
NelsonM1984
@koalid, Just to add - the colour change in the line is signalling the same crossover, hence the dot is redundant. Which is why I'm thinking there might be a more intuitive way to colour the line itself, instead of just seeing the 9 over/under 15 situation.
koalid
@NelsonM1984,

//@version=4

// OBV oscillator
// fr.tradingview.com/script/djp9tBlm-On-Balance-Volume-Oscillator-with-Divergence-and-Pivots/
// mixed with
// Accumulation/Distribution - with markers
// tradingview.com/script/SDApu80T-Accumulation-Distribution-with-markers/

study(title="🍑OBV + Accumulation/distribution",
shorttitle="🍑",
format=format.volume,
precision=0,
resolution="")

src = input(close, title="Source")
shortLength = input(1, title="Short OBV period")
longLength = input(20, title="Long OBV period")
pivR = input(title="OBV Wave Pivot Lookback Right", defval=1)
pivL = input(title="OBV Wave Pivot Lookback Left", defval=20)

// 1 - Compute regular OBV
obv = cum(change(src) > 0 ? +volume : change(src) < 0 ? -volume : 0*volume)

// 2 - Compute OBV ocillator
obvOsc = ema(obv, shortLength) - ema(obv, longLength)
obvColor = obvOsc > 0 ? color.new(color.aqua,60) : color.new(color.orange,60)

// Divergence
up = rma(max(change(src), 0), shortLength)
down = rma(-min(change(src), 0), shortLength)
lbR = input(title="Divergence Pivot Lookback Right", defval=2)
lbL = input(title="Divergence Pivot Lookback Left", defval=5)
rangeUpper = input(title="Max of Lookback Range", defval=100)
rangeLower = input(title="Min of Lookback Range", defval=2)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=true)
bearColor = color.new(color.red, 0)
bullColor = color.new(color.green, 0)
hiddenBullColor = color.new(color.aqua, 0)
hiddenBearColor = color.new(color.orange, 0)
textColor = color.new(color.white, 0)
noneColor = color.new(color.white, 100)
osc = ema(obv, shortLength) - ema(obv, longLength)
plFound = na(pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
bars = barssince(cond == true)
rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low

oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Lower Low

priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)
bullCond = plotBull and priceLL and oscHL and plFound

plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=1,
color=(bullCond ? bullColor : noneColor),
transp=0
)

plotshape(
bullCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish Label",
style=shape.labelup,
location=location.absolute,
size=size.tiny,
color=bullColor,
textcolor=textColor,
transp=0
)

//-------------------------------
koalid
This is my your code mixed with an OBV.
Your red dots are red bars x10, actually.

And I have no idea how to use properly, to be honest... 😅 i trade crypto altcoins only.
NelsonM1984
@koalid, hi mate, yeah I trade crypto and stocks. Have you been trading long? And coding pine?

Yeah I like the OBV oscillator with divergence, it seems solid - thanks! The Acc/Dist seems like it could be interesting, but I don't fully appreciate how to read it yet, need to do some more reading.

You might find Pocket Pivots quite useful, they are a decent tool to utilise alongside the OBV divergence tradingview.com/script/GrVbLlPy-Pocket-Pivot-Indicator/
เพิ่มเติม