PriceOsc Squeeze For ThinkOrSwim

KC8

New member
Here is the PriceOsc. I am using these settings is because it seems to mimic John Carter’s “Trend Rotation” indicator (not his higher time frame ones that clutter his charts).

He has said that he has three different ones based on the:
1. MACDTwoLines;
2. Squeeze Histogram;
3. and Secret Sauce?

He also uses multiple time frames on just one chart. I looked at various possibilities, but decided that (for me) simple was much better and I settled on 1-minute, 3-minute and 5-minute charts (to day trade) along with a single period PriceOsc on each chart (with these settings) substituting for John Carter’s Trend Rotation Tool …

since I was not going to buy his indicator and I have no idea what his actual setting are. John Carter’s higher time frames seem to lag too much for my style of trading, so I just use this one. With the lower panel multi-color change background from SleepyZ, it makes the crossovers easier to spot quickly and with just a glance.

mod note:
Also see @csricksdds version here:
https://usethinkscript.com/threads/priceosc-squeeze-for-thinkorswim.17995/#post-138405


@SleepyZ,
RESPECT!!!
THANK YOU for showing us how to change the background color of a single lower panel on a TOS chart. I often thought about it, but I did not think it was even possible to do. Wow … this has really opened up some possibilities!

Make any modifications that you think would help. Good trading!
zIA5AhR.png

Ruby:
# PriceOsc_wBackgroundColor_wSqueezePro

declare lower;
input colorNormLength = 11;
input fastLength = 3;
input price = close;
input slowLength = 5;
input averageType = AverageType.WILDERS;
input MALength = 3;
plot PriceOsc = MovingAverage(averageType, price, fastLength) - MovingAverage(averageType, price, slowLength);
plot ZeroLine = 0;
plot MA = Average(PriceOsc, MALength);
PriceOsc.SetDefaultColor(Color.CYAN);
PriceOsc.SetLineWeight(3);
ZeroLine.SetDefaultColor(Color.DARK_GRAY);
MA.SetDefaultColor(Color.RED);

input length = 20;
#Keltner Channels
def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = Average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
#Bollinger Bands
def BB_offset = 2.0;
def sDev = stdev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
#Squeeze
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
squeeze.SetLineWeight(4);
squeeze.SetStyle(curve.POINTS);
squeeze.AssignValueColor(if s1 then CreateColor(255, 255, 0)
else if s2 then CreateColor(255, 0, 0)
else if s3 then CreateColor(102, 0, 255)
else CreateColor(128, 128, 128));

DefineGlobalColor("Positive", CreateColor(0, 153, 0));
DefineGlobalColor("Negative", CreateColor(153, 0, 0));

input colorBackground = yes;
def xcolor=if PriceOsc > 0 then 1 else 0;
addcloud(if !colorBackground then double.nan
else if xcolor==1
then double.POSITIVE_INFINITY
else double.NEGATIVE_INFINITY,
if xcolor==1
then double.NEGATIVE_INFINITY
else double.POSITIVE_INFINITY,
globalColor("Positive"), globalcolor("Negative"));
 
Last edited by a moderator:

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

Here is the PriceOsc. I am using these settings is because it seems to mimic John Carter’s “Trend Rotation” indicator (not his higher time frame ones that clutter his charts).

He has said that he has three different ones based on the:
1. MACDTwoLines;
2. Squeeze Histogram;
3. and Secret Sauce?

He also uses multiple time frames on just one chart. I looked at various possibilities, but decided that (for me) simple was much better and I settled on 1-minute, 3-minute and 5-minute charts (to day trade) along with a single period PriceOsc on each chart (with these settings) substituting for John Carter’s Trend Rotation Tool …

since I was not going to buy his indicator and I have no idea what his actual setting are. John Carter’s higher time frames seem to lag too much for my style of trading, so I just use this one. With the lower panel multi-color change background from SleepyZ, it makes the crossovers easier to spot quickly and with just a glance.

@SleepyZ,
RESPECT!!!
THANK YOU for showing us how to change the background color of a single lower panel on a TOS chart. I often thought about it, but I did not think it was even possible to do. Wow … this has really opened up some possibilities!

Make any modifications that you think would help. Good trading!
zIA5AhR.png

Ruby:
# PriceOsc_wBackgroundColor_wSqueezePro

declare lower;
input colorNormLength = 11;
input fastLength = 3;
input price = close;
input slowLength = 5;
input averageType = AverageType.WILDERS;
input MALength = 3;
plot PriceOsc = MovingAverage(averageType, price, fastLength) - MovingAverage(averageType, price, slowLength);
plot ZeroLine = 0;
plot MA = Average(PriceOsc, MALength);
PriceOsc.SetDefaultColor(Color.CYAN);
PriceOsc.SetLineWeight(3);
ZeroLine.SetDefaultColor(Color.DARK_GRAY);
MA.SetDefaultColor(Color.RED);

input length = 20;
#Keltner Channels
def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = Average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
#Bollinger Bands
def BB_offset = 2.0;
def sDev = stdev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
#Squeeze
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
squeeze.SetLineWeight(4);
squeeze.SetStyle(curve.POINTS);
squeeze.AssignValueColor(if s1 then CreateColor(255, 255, 0)
else if s2 then CreateColor(255, 0, 0)
else if s3 then CreateColor(102, 0, 255)
else CreateColor(128, 128, 128));

DefineGlobalColor("Positive", CreateColor(0, 153, 0));
DefineGlobalColor("Negative", CreateColor(153, 0, 0));

input colorBackground = yes;
def xcolor=if PriceOsc > 0 then 1 else 0;
addcloud(if !colorBackground then double.nan
else if xcolor==1
then double.POSITIVE_INFINITY
else double.NEGATIVE_INFINITY,
if xcolor==1
then double.NEGATIVE_INFINITY
else double.POSITIVE_INFINITY,
globalColor("Positive"), globalcolor("Negative"));
KC9, what are the color of the dots telling me?
 
Being somewhat of a contrarian and liking everything on my upper chart itself, I have made some changes. Green dots = no squeeze; Squeeze 1 = Cyan; squeeze 2 = Red; squeeze 3 = Yellow.

Since it opens on your lower chart you can highlight it and move it upwards from lower to upper (above the volume study) to upper chart indicator area. This will place the color dots along the center of the chart as follows:

# PriceOsc_wBackgroundColor_wSqueezePro
#Revaqmped to upper chart dots by C. Ricks as follows: Squeeze 1 = Cyan; squeeze 2 = Red; squeeze 3 = yellow

declare lower;
input colorNormLength = 11;
input fastLength = 3;
input price = close;
input slowLength = 5;
input averageType = AverageType.Exponential;
input MALength = 3;
plot PriceOsc = MovingAverage(averageType, price, fastLength) - MovingAverage(averageType, price, slowLength);
plot ZeroLine = 0;
plot MA = Average(PriceOsc, MALength);

input length = 20;
#Keltner Channels
def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = Average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
#Bollinger Bands
def BB_offset = 2.0;
def sDev = stdev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
#Squeeze
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
squeeze.SetLineWeight(4);
squeeze.SetStyle(curve.POINTS);
squeeze.AssignValueColor(if s1 then CreateColor(0, 255, 255)
else if s2 then CreateColor(255, 0, 0)
else if s3 then CreateColor(255, 255, 0)
else CreateColor(0, 255, 0));
 
KC9, what are the color of the dots telling me?
@PaulS, those are SqueezePro dots. The colors represent: No Squeeze (gray); Loose Squeeze (purple); Regular Squeeze (red); and Tight Squeeze (yellow). The squeeze code was posted on useThinkscript by some talented coders that replicate what John Carter uses on SimplerTrading. You can find information about it on this site, on SimplerTrading, or just google "SqueezePro" and watch videos or read what is posted. I like to use it because sometimes (not always) squeezes precede larger than expected moves. Hope this helps. Good trading!
 
Here is the PriceOsc. I am using these settings is because it seems to mimic John Carter’s “Trend Rotation” indicator (not his higher time frame ones that clutter his charts).

He has said that he has three different ones based on the:
1. MACDTwoLines;
2. Squeeze Histogram;
3. and Secret Sauce?

He also uses multiple time frames on just one chart. I looked at various possibilities, but decided that (for me) simple was much better and I settled on 1-minute, 3-minute and 5-minute charts (to day trade) along with a single period PriceOsc on each chart (with these settings) substituting for John Carter’s Trend Rotation Tool …

since I was not going to buy his indicator and I have no idea what his actual setting are. John Carter’s higher time frames seem to lag too much for my style of trading, so I just use this one. With the lower panel multi-color change background from SleepyZ, it makes the crossovers easier to spot quickly and with just a glance.

@SleepyZ,
RESPECT!!!
THANK YOU for showing us how to change the background color of a single lower panel on a TOS chart. I often thought about it, but I did not think it was even possible to do. Wow … this has really opened up some possibilities!

Make any modifications that you think would help. Good trading!
zIA5AhR.png

Ruby:
# PriceOsc_wBackgroundColor_wSqueezePro

declare lower;
input colorNormLength = 11;
input fastLength = 3;
input price = close;
input slowLength = 5;
input averageType = AverageType.WILDERS;
input MALength = 3;
plot PriceOsc = MovingAverage(averageType, price, fastLength) - MovingAverage(averageType, price, slowLength);
plot ZeroLine = 0;
plot MA = Average(PriceOsc, MALength);
PriceOsc.SetDefaultColor(Color.CYAN);
PriceOsc.SetLineWeight(3);
ZeroLine.SetDefaultColor(Color.DARK_GRAY);
MA.SetDefaultColor(Color.RED);

input length = 20;
#Keltner Channels
def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = Average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
#Bollinger Bands
def BB_offset = 2.0;
def sDev = stdev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
#Squeeze
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
squeeze.SetLineWeight(4);
squeeze.SetStyle(curve.POINTS);
squeeze.AssignValueColor(if s1 then CreateColor(255, 255, 0)
else if s2 then CreateColor(255, 0, 0)
else if s3 then CreateColor(102, 0, 255)
else CreateColor(128, 128, 128));

DefineGlobalColor("Positive", CreateColor(0, 153, 0));
DefineGlobalColor("Negative", CreateColor(153, 0, 0));

input colorBackground = yes;
def xcolor=if PriceOsc > 0 then 1 else 0;
addcloud(if !colorBackground then double.nan
else if xcolor==1
then double.POSITIVE_INFINITY
else double.NEGATIVE_INFINITY,
if xcolor==1
then double.NEGATIVE_INFINITY
else double.POSITIVE_INFINITY,
globalColor("Positive"), globalcolor("Negative"));
Very Similar to TrueMomentumOscillator
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
346 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