Professional Documents
Culture Documents
This source code is subject to the terms of the Mozilla Public License 2
This source code is subject to the terms of the Mozilla Public License 2
0 at
https://mozilla.org/MPL/2.0/
// © piriya33
//@version=4
study("CDC Divergences","CDC Divergences",overlay=true, max_labels_count = 500)
chksrc = input("RSI","Check
Against:",input.string,options=["RSI","MACD","Stoch","Volume","OBV"])
HH = _high0 > _high0[1] and _high0 > _high1 // Checks for Higher Highs
LL = _low0 < _low0[1] and _low0 < _low1 // Cheks for Lower Lows
// Plot Lines Showing Pivot Highs and Pivot Lows on occurance 0 and 1
// plot(src)
// plot(_low0, color=color.red, style=plot.style_stepline, offset=-len1)
// plot(_low1, color=color.orange, style=plot.style_stepline, offset=-len1)
// plot(_high0, color=color.green, style=plot.style_stepline, offset=-lenL)
// plot(_high1, color=color.blue, style=plot.style_stepline, linewidth=2, offset=-
lenL)
// Signals
[macd,_,_] = macd(macd_src,macd_fast,macd_slow,9)
k = sma(stoch(close,high,low,sto_klen),sto_ksmt)
d = sma(k,sto_dsmt)
vol = volume
_obv = obv
else
na