For the last few days, I've been trying to plot specific information on the chart but it did not go through well.. I would be grateful if anyone could help me with that...
I am trying to spot the highest bar within the completed MACD histogram(above 0), and the lowest bar within the completed MACD histogram(below 0). I have attached a screenshot for reference. After spotting the last 2 highest(or lowest), I would draw a trend line of them..
/////The code is here. I have separated the +,- histogram, and put dots above and below of +,- histogram
![Highest and Lowest bar within the completed MACD histogram](https://user-images.githubusercontent.com/50862449/81238546-5af1ff80-8fd0-11ea-885f-36ccb5a2d086.png)
//@Version=4
study(title="My MACD", shorttitle="My MACD", overlay=true)
// Getting inputs
fast_length = input(title="Fast Length",
type=input.integer, defval=12)
slow_length = input(title="Slow Length",
type=input.integer, defval=26)
src = input(title="Source", type=input.source,
defval=close)
signal_length = input(title="Signal Smoothing",
type=input.integer, defval = 9)
// Calculating
fast_ma = ema(src, fast_length)
slow_ma = ema(src, slow_length)
macd = fast_ma - slow_ma
signal = ema(macd, signal_length)
hist = macd - signal
// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00
//////////////////////////////////////// Plot ////////////////////////////////////////////////////
// Dots(+histogram and -histogram)
plotshape(hist>=0, "Dots histogram +", color=color.green, style=shape.cross, location=location.top)
plotshape(hist<=0, "Dots histogram -", color=color.red, style=shape.cross, location=location.bottom)
// +Histogram and -histogram
plot(hist, title="Histogram +", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : na), transp=0 )
plot(hist, title="Histogram -", style=plot.style_columns, color=(hist<=0 ? (hist[1] < hist ? col_grow_below : col_fall_below) : na), transp=0 )