Points of Control Support/Resistance Areas

Chuck

Moderator
Staff member
iwaLLNm.png
Locates last 10 Points of Control based on RTH only

Code:
# Points Of Control Support / Resistance Areas
# Mobius
# V01.03.08.2016
# Locates last 10 Points of Control based on RTH only

declare Hide_On_Daily;

input RthBegin  = 0930; #hint RthBegin: Regular Trading Hours Begin
input RthEnd    = 1600; #hint RthEnd: Regular Trading Hours End.
input RoundingFunction  = .5; #hint RoundingFunction: Round to nearest ?

def ATR = HighestAll(if isNaN(close[-1])
                     then if Average(TrueRange(high, close, low), 4) < 2
                          then Average(TrueRange(high, close, low), 4)
                          else 2
                     else double.nan);
def RTH = SecondsFromTime(RthBegin) > 0 and
          SecondsTillTime(RthEnd) >= 0;
def cond = RTH != RTH[1];
profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, "numberOfProfiles" = 20, "pricePerRow" = PricePerRow.TICKSIZE, "value area percent" = 68.4);
def poc =  if RTH then Round(vol.GetPointOfControl() / RoundingFunction, 0) * RoundingFunction else Double.NaN;
def Poc1 = if !RTH and RTH[1]
           then poc[1]
           else Poc1[1];
def Poc2 = if !RTH and RTH[1]
           then Poc1[1]
           else Poc2[1];
def Poc3 = if !RTH and RTH[1]
           then Poc2[1]
           else Poc3[1];
def Poc4 = if !RTH and RTH[1]
           then Poc3[1]
           else Poc4[1];
def Poc5 = if !RTH and RTH[1]
           then Poc4[1]
           else Poc5[1];
def Poc6 = if !RTH and RTH[1]
           then Poc5[1]
           else Poc6[1];
def Poc7 = if !RTH and RTH[1]
           then Poc6[1]
           else Poc7[1];
def Poc8 = if !RTH and RTH[1]
           then Poc7[1]
           else Poc8[1];
def Poc9 = if !RTH and RTH[1]
           then Poc8[1]
           else Poc9[1];
plot pc =  HighestAll(if isNaN(close[-1])
           then poc
           else double.nan);
pc.SetStyle(Curve.Firm);
pc.SetDefaultColor(Color.Orange);
pc.SetLineWeight(2);
addCloud(pc-ATR, pc+ATR, createColor(150,7,5), createColor(150,7,5));
plot pc1 = HighestAll(if isNaN(close[-1])
           then Poc1
           else double.nan);
pc1.SetStyle(Curve.Long_Dash);
pc1.SetDefaultColor(Color.Orange);
addCloud(pc1-ATR, pc1+ATR, color.dark_gray, color.dark_gray);
plot pc2 = HighestAll(if isNaN(close[-1])
           then poc2
           else double.nan);
pc2.SetStyle(Curve.Long_Dash);
pc2.SetDefaultColor(Color.Orange);
addCloud(pc2-ATR, pc2+ATR, color.dark_gray, color.dark_gray);
plot pc3 = HighestAll(if isNaN(close[-1])
           then poc3
           else double.nan);
pc3.SetStyle(Curve.Long_Dash);
pc3.SetDefaultColor(Color.Orange);
addCloud(pc3-ATR, pc3+ATR, color.dark_gray, color.dark_gray);
plot pc4 = HighestAll(if isNaN(close[-1])
           then poc4
           else double.nan);
pc4.SetStyle(Curve.Long_Dash);
pc4.SetDefaultColor(Color.Orange);
addCloud(pc4-ATR, pc4+ATR, color.dark_gray, color.dark_gray);
plot pc5 = HighestAll(if isNaN(close[-1])
           then poc5
           else double.nan);
pc5.SetStyle(Curve.Long_Dash);
pc5.SetDefaultColor(Color.Orange);
addCloud(pc5-ATR, pc5+ATR, color.dark_gray, color.dark_gray);
plot pc6 = HighestAll(if isNaN(close[-1])
           then poc6
           else double.nan);
pc6.SetStyle(Curve.Long_Dash);
pc6.SetDefaultColor(Color.Orange);
addCloud(pc6-ATR, pc6+ATR, color.dark_gray, color.dark_gray);
plot pc7 = HighestAll(if isNaN(close[-1])
           then poc7
           else double.nan);
pc7.SetStyle(Curve.Long_Dash);
pc7.SetDefaultColor(Color.Orange);
addCloud(pc7-ATR, pc7+ATR, color.dark_gray, color.dark_gray);
plot pc8 = HighestAll(if isNaN(close[-1])
           then poc8
           else double.nan);
pc8.SetStyle(Curve.Long_Dash);
pc8.SetDefaultColor(Color.Orange);
addCloud(pc8-ATR, pc8+ATR, color.dark_gray, color.dark_gray);
plot pc9 = HighestAll(if isNaN(close[-1])
           then poc9
           else double.nan);
pc9.SetStyle(Curve.Long_Dash);
pc9.SetDefaultColor(Color.Orange);
addCloud(pc9-ATR, pc9+ATR, color.dark_gray, color.dark_gray);
 
Top