I've been working on a Vertical Line Trend indicator to give me a heads up to my AsGoodAsItGets and I'm stumped. I would only like to hae the Trend Change (Red/Green) and get rid of the Transition Lines. Can you help? Here is the indicator thus far:
##AsGood_Trend_Line
declare upper;
input Length =21;
input Reversal = 3.0;
def Change;
def V;
def p1v = Max(-100, Min(100, (StochasticFull(kPeriod = 5, slowing_period = 3, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p2v = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p3v = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
if p2v > 0
Then {
Change = if p1v <= p2v and p1v[1] > p2v[1] and p2v[1] > 0 then -1 else 0;
V = CompoundValue(1, Min (0, V[1]) + Change, 0);
}
else {
Change = if p1v >= p2v and p1v[1] < p2v[1] and p2v[1] <= 0 then 1 else 0;
V = CompoundValue (1, Max (0, V[1]) + Change, 0);
}
DefineGlobalColor ("Trend Transition Buy", Color.Light_Green);
DefineGlobalColor ("TREND CHANGE Buy", Color.Green);
DefineGlobalColor ("Trend Transition Sell", Color.Light_RED);
DefineGlobalColor ("TREND CHANGE SELL", Color.RED);
AddVerticalLine (((p2v > 0 and p1v <= p2v and p1v[1] > p2v[1]) or (p2v < 0 and p1v >= p2v and p1v[1] < p2v[1])),
if AbsValue(V) > 1 then "TREND CHANGE" else "Trend Transition",
if V > 1 then
GlobalColor ("TREND CHANGE BUY")
else if V == 1 then
GlobalColor ("Trend Transition Buy")
else if V < -1 then
GlobalColor ("TREND CHANGE SELL")
else GlobalColor ("Trend Transition Sell"));
#End
##AsGood_Trend_Line
declare upper;
input Length =21;
input Reversal = 3.0;
def Change;
def V;
def p1v = Max(-100, Min(100, (StochasticFull(kPeriod = 5, slowing_period = 3, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p2v = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p3v = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
if p2v > 0
Then {
Change = if p1v <= p2v and p1v[1] > p2v[1] and p2v[1] > 0 then -1 else 0;
V = CompoundValue(1, Min (0, V[1]) + Change, 0);
}
else {
Change = if p1v >= p2v and p1v[1] < p2v[1] and p2v[1] <= 0 then 1 else 0;
V = CompoundValue (1, Max (0, V[1]) + Change, 0);
}
DefineGlobalColor ("Trend Transition Buy", Color.Light_Green);
DefineGlobalColor ("TREND CHANGE Buy", Color.Green);
DefineGlobalColor ("Trend Transition Sell", Color.Light_RED);
DefineGlobalColor ("TREND CHANGE SELL", Color.RED);
AddVerticalLine (((p2v > 0 and p1v <= p2v and p1v[1] > p2v[1]) or (p2v < 0 and p1v >= p2v and p1v[1] < p2v[1])),
if AbsValue(V) > 1 then "TREND CHANGE" else "Trend Transition",
if V > 1 then
GlobalColor ("TREND CHANGE BUY")
else if V == 1 then
GlobalColor ("Trend Transition Buy")
else if V < -1 then
GlobalColor ("TREND CHANGE SELL")
else GlobalColor ("Trend Transition Sell"));
#End