- Platform
-
- Thinkorswim

Code:
# AD Line With Bracket Lower Study
# Mobius
# V01.2.2014
declare lower;
input symb = "$ADSPD";
def o1 = if open(symbol = symb) > close(symbol=symb)
then open(symbol = symb)
else double.nan;
def c1 = if open(symbol = symb) > close(symbol = symb)
then close(symbol = symb)
else double.nan;
def h1 = if open(symbol = symb) > close(symbol = symb)
then high(symbol = symb)
else double.nan;
def l1 = if open(symbol = symb) > close(symbol = symb)
then low(symbol = symb)
else double.nan;
def o = if open(symbol = symb) <= close(symbol=symb)
then open(symbol=symb)
else double.nan;
def h = high(symbol = symb);
def l = low(symbol = symb);
def c = if open(symbol = symb) <= close(symbol = symb)
then close(symbol = symb)
else double.nan;
AddChart(growColor = Color.RED,
fallColor = Color.RED,
neutralColor = Color.RED,
high = l1, low = h1, open = o1, close = c1,
type = ChartType.candle);
AddChart(growColor = Color.GREEN,
fallColor = Color.red,
neutralColor = Color.CURRENT,
high = h, low = l, open = o, close = c,
type = ChartType.candle);
def Active = if SecondsFromTime(0930) > 0 and
SecondsTillTime(1000) >= 0
then 1
else 0;
def CurrDay = GetDay() == GetLastDay();
plot zero = if SecondsFromTime(0930) >= 0 and
SecondsTillTime(1600) >= 0 and
!isNaN(close)
then 0
else double.nan;
def hh = if !Active[1] and Active
then high(symb)[1]
else if Active and high(symb) > hh[1]
then high(symb)
else hh[1];
def ll = if !Active[1] and Active
then low(symb)[1]
else if Active and low(symb) < ll[1]
then low(symb)
else ll[1];
plot High_Line = if CurrDay and hh == hh[1] then hh else double.nan;
High_Line.SetStyle(Curve.Long_Dash);
High_Line.SetLineWeight(1);
High_Line.SetDefaultColor(Color.Cyan);
plot Low_Line = if CurrDay and ll == ll[1] then ll else double.nan;
Low_Line.SetStyle(Curve.Long_Dash);
Low_Line.SetLineWeight(1);
Low_Line.SetDefaultColor(Color.Orange);
AddLabel(1, SYMB + " = " + close(symb), Color.White);
AddVerticalLine(!isNaN(zero) and isNaN(zero[1]), "RTH", Color.white, Curve.Short_Dash);
# End Code AD Bracket Lower Study