Time Anchored Plot to Current Close

Chuck

Moderator
Staff member
ICiaWI0.png

Code:
# Time Anchored Plot To Current Close
# Mobius
# V02.01.07.2016
# Simplified Code form V01.2011 version

input BeginTime = 0930;
input X_value = open;
input Display_Label = yes;
def Active = if SecondsTillTime(BeginTime) == 0 and
                SecondsFromTime(BeginTime) == 0 and
                GetDay() == GetLastDay()
             then 1
             else 0;
def X = if Active
        then X_Value
        else X[1];
plot Line = if Active
            then X
            else if IsNaN(close[-1])
                 then close
                 else double.nan;
Line.EnableApproximation();
Line.SetStyle(Curve.Firm);
Line.SetDefaultColor(Color.Cyan);
def z = if Active
            then X
            else if IsNaN(close[-1])
                 then HighestAll(x)
                 else double.nan;
def FirstBar = if Active
               then BarNumber()
               else double.nan;
plot zero = if barNumber() == HighestAll(FirstBar)
            then x
            else if barNumber() > HighestAll(FirstBar)
                 then x
                 else double.nan;
zero.SetDefaultColor(Color.Cyan);
# End Code Anchored Line
 
Top