As a Trend Arrow Lover I took out everything but the arrows. I hope that is OK. Here is the code with only the direction arrows:
# posted to
[email protected] - 11/28/2012
# this study was also found on thinkscripter.com circa 11/2013
# author : unknown ( possibly David Elliot, Eric Purdy, or Mobius )
input BreakArrows = yes;
input ShowAlerts = yes;
input price = close;
input displace = 0;
input length = 10;
input Num_Dev_Dn = -0.8;
input Num_Dev_Up = +0.8;
def lastBar = if (IsNaN(close), 1, 0);
def sDev = stdev(data = price[-displace], length = length);
def MidLine = Average(data = price[-displace], length = length);
def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;
def MoboStatus =
if close > UpperBand then 2 # Mobo Up
else
if close < LowerBand then -2 # Mobo Down
else 0 ; # between the bands
rec BreakStatus = compoundValue(1,
if BreakStatus[1] == MoboStatus or MoboStatus == 0 then BreakStatus[1]
else
if MoboStatus == 2 then 2
else -2, 0);
plot BreakOutArrow =
if BreakArrows then
if BreakStatus[0] == BreakStatus[1] then double.NAN
else if BreakStatus[0] == 2 then
close else double.NAN
else double.NAN;
BreakOutArrow.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
BreakOutArrow.SetDefaultColor(Color.Red);
BreakOutArrow.SetLineWeight(3);
plot BreakDownArrow =
if BreakArrows then
if BreakStatus[0] == BreakStatus[1] then double.NAN
else if BreakStatus[0] == -2 then
close else double.NAN
else double.NAN;
BreakDownArrow.SetPaintingStrategy(PaintingStrategy.Arrow_Down);
BreakDownArrow.SetDefaultColor(Color.Green);
BreakDownArrow.SetLineWeight(3);