HLC Trend Identifier + Mom Squeeze V02 + Volatility Ocs For ThinkOrSwim

samer800

Moderator - Expert
VIP
Lifetime
wait for the squeeze, then HLC cross and increase in hist... or skip the squeeze, wait for the cross and add base line :)

ARkanlY.png


# Momentum Squeeze V02 by Mobius + "HLC Trend" + Volatility Osc
#https://www.tradingview.com/script/Zjk4UJF5-HLC-Trend-Identifier/
#https://www.tradingview.com/script/XL9nXxyY-Volatility-Oscillator/
# New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication.
# Mod & converted by Sam4COK @ 07/2022

declare lower;
def na = Double.NaN;
input n = 20;

def c = close;
def mean = Inertia(c, n);
def SD = Sqrt((fold i = 0 to n
with s
do s + Sqr(mean - GetValue(c, i))) / n);
plot Momo = Inertia((c - mean) / SD, Floor(n ));
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.AssignValueColor(if Momo > Momo[1] and Momo > 0
then Color.CYAN
else if Momo > 0 and Momo < Momo[1]
then Color.BLUE
else if Momo < 0 and Momo < Momo[1]
then CreateColor(255, 0, 98)
else Color.ORANGE);
def upper = mean + (2 * SD);
def lower = mean - (2 * SD);
def W = (upper - lower) / mean;
def B = Highest(W, n * 2);
def Sq = Lowest(W, n * 2);
plot Squeeze = if ((W - Sq) / (B - Sq)) <= .01
then 0
else na;
Squeeze.SetStyle(Curve.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.WHITE);
AddLabel(Squeeze, "Squeeze", Color.YELLOW);


#study("HLC Trend")

#// Inputs
input ShowHLC = yes;
input length_Close = 5; # "Close MA Period Length", type = integer)
input length_High = 30; # "High MA Period Length", type = integer)
input length_Low = 13; # "Low MA Period Length", type = integer)
input type_MA = {default SMA, EMA, WMA};
input fill_Cloud = yes; #"Use cloud coloring for Bull/Bear identification?", type = bool)
input fill_BG = no; # "Color Indicator background based on Bull/Bear/Neautral?", type = bool)
input TrendLebel = yes;

#// Pull traditional HLC
def sOpen = open;
def sHigh = high;
def sLow = low;
def sClose = close;

#// Calculations
def ma_High;
def ma_Low;
def ma_Close;
def ma_Open;
switch (type_MA) {
case SMA:
ma_High = SimpleMovingAvg(sHigh, length_High);
ma_Low = SimpleMovingAvg(sLow, length_Low);
ma_Close = SimpleMovingAvg(sClose, length_Close);
ma_Open = SimpleMovingAvg(sOpen, length_Close);
case EMA:
ma_High = ExpAverage(sHigh, length_High);
ma_Low = ExpAverage(sLow, length_Low);
ma_Close = ExpAverage(sClose, length_Close);
ma_Open = ExpAverage(sOpen, length_Close);
case WMA:
ma_High = WMA(sHigh, length_High);
ma_Low = WMA(sLow, length_Low);
ma_Close = WMA(sClose, length_Close);
ma_Open = WMA(sOpen, length_Close);
}
def ma_CH = ma_Close - ma_High;
def ma_LC = ma_Low - ma_Close;

#// Draw Colors
def fill_Color = if ma_CH > ma_LC then 1 else 0;
def bg_Color = if ma_CH >= ma_LC then if (ma_CH < 0 and ma_CH < ma_CH[1]) then 0 else 1
else if (ma_LC < 0 and ma_LC < ma_LC[1]) then 0 else -1;
## Volatility Osc

def spike = ma_Close - ma_Open; #"Spike Linel"

def x = StDev(spike, length_Close);
def y = StDev(spike, length_Close) * -1;

plot VolaLine = 0;
VolaLine.AssignValueColor(if spike > x then Color.GREEN else
if spike < y then Color.RED else Color.GRAY);
VolaLine.SetLineWeight(2);
#// Draw Out

plot plot_CH = if ShowHLC then ma_CH else na; # "MA Close - MA High"
plot_CH.SetDefaultColor(Color.GREEN);

plot plot_LC = if ShowHLC then ma_LC else na; # "MA Low - MA Close"
plot_LC.SetDefaultColor(Color.RED);

def Trend = if bg_Color > 0 and Momo > 0 and spike > x then 1 else
if bg_Color < 0 and Momo < 0 and spike < y then -1 else na;

AddLabel (if TrendLebel and Trend then yes else na , "Trend", if Trend > 0 then Color.GREEN else
if Trend < 0 then Color.RED else Color.GRAY);

AddCloud (if ShowHLC and fill_BG and bg_Color > 0 then Double.POSITIVE_INFINITY else na, Double.NEGATIVE_INFINITY, Color.GREEN);
AddCloud (if ShowHLC and fill_BG and bg_Color == 0 then Double.POSITIVE_INFINITY else na, Double.NEGATIVE_INFINITY, CreateColor(255, 255, 0));
AddCloud (if ShowHLC and fill_BG and bg_Color < 0 then Double.POSITIVE_INFINITY else na, Double.NEGATIVE_INFINITY, Color.RED);

AddCloud (if ShowHLC and fill_Cloud then ma_CH else na, ma_LC , Color.DARK_GREEN, Color.DARK_RED, no);
AddCloud (if ShowHLC and fill_Cloud then ma_CH else na, ma_LC , Color.DARK_GREEN, Color.DARK_RED, no);

#// END Cloud fill selector
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
273 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top