Came across a Mobius range indicator GACD it appears to be very telling I'm using this on intraday.
Code:
# GACD (G)aussian (A)verage (C)onvergence (D)ivergence
# Mobius
# V01.01.2019
# Study shows Long Term Trend with shading above and below the zero line. Short Term Trend with faster and slower Gaussian Average color line plots. Convergence and Divergence is displayed by the Histogram. Crosses of the Averages and therefore crosses of the Histogram above an below zero are marked with corresponding colored vertical lines. A label has been added to remind the user of trend indication.
# Note: This study plots on Mobile without some of the features.
declare lower;
input length = 21;
input length2 = 34;
input length3 = 21;
script G
{
input iData = close;
input length = 21;
def h = high;
def l = low;
def c = close;
def betaDenom = 10 * (Log(Sum((Max(h, c[1]) - Min(l, c[1])), length) /
(Highest(h, length) - Lowest(l, length)))
/ Log(length));
def w = (2 * Double.Pi / length);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDenom) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def G = Power(alpha, 4) * iData +
4 * (1 – alpha) * G[1] – 6 * Power( 1 - alpha, 2 ) * G[2] +
4 * Power( 1 - alpha, 3 ) * G[3] - Power( 1 - alpha, 4 ) * G[4];
plot data = G;
}
plot a = G(close, length) - G(close, length2);
plot b = G(a, length3);
plot d = a - b;
plot "0" = if IsNaN(close)
then Double.NaN
else 0;
"0".SetDefaultColor(Color.WHITE);
"0".HideTitle();
a.AssignValueColor(if a > b
then Color.GREEN
else Color.RED);
a.HideBubble();
a.HideTitle();
b.AssignValueColor(if a > b
then Color.GREEN
else Color.RED);
b.HideBubble();
b.HideTitle();
d.SetLineWeight(4);
d.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
d.AssignValueColor(if d > 0 and d > d[1]
then Color.GREEN
else if d > 0 and d < d[1]
then Color.BLUE
else if d < 0 and d < d[1]
then Color.RED
else Color.YELLOW);
d.HideBubble();
AddCloud(a, b, Color.GREEN, Color.RED);
AddVerticalLine(d crosses 0, "", if d crosses above 0
then Color.GREEN
else Color.RED);
AddCloud(if Max(a, b) < 0
then Max(a, b)
else Double.NaN, 0, Color.LIGHT_RED, Color.LIGHT_RED);
AddCloud(if Min(a, b) > 0
then 0
else Double.NaN, Min(a, b), Color.LIGHT_GREEN, Color.LIGHT_GREEN);
AddLabel(1, if Max(a, b) < 0 and a < b
then "Trend Down"
else if Max(a, b) < 0 and a > b
then "Trend Down Slowing"
else if between(0, b, a) and d > d[1]
then "Trend Reversing"
else if Min(a, b) > 0 and a > b
then "Trend Up"
else if Min(a, b) > 0 and a < b
then "Trend Up Slowing"
else if Min(a, b) > 0 and d > d[1]
then "Trend Up Accelerating"
else if Min(a, b) > 0 and a < b and d < d[1]
then "Trend Up decelerating"
else "Undetermined Trend", if Max(a, b) < 0
then color.light_red
else if Min(a, b) > 0
then color.light_green
else color.white);
# End Code GACD
Last edited by a moderator: