Sectors High Jump Osc For ThinkOrSwim

henry1224

Expert
VIP
Lifetime
Code:
#Henry Z Kaczmarczyk 09 06 2021
declare lower;

input symbol11 = "XLY";
input symbol10 = "XLV";
input symbol9 = "XLU";
input symbol8 = "XLRE";
input symbol7 = "XLP";
input symbol6 = "XLK";
input symbol5 = "XLI";
input symbol4 = "XLF";
input symbol3 = "XLE";
input symbol2 = "XLC";
input symbol1 = "XLB";

Input MN1 = 17;
Input MN2 = 50;
Input MN3 = 100;
Input MN4 = 200;
Input Threshold = 95;
Input Lookback = 200;
script SymbolHJOsc {
input symbol = "";
Input MN1 = 17;
Input MN2 = 50;
Input MN3 = 100;
Input MN4 = 200;
Input Lookback = 200;
def price = close(Symbol);
def MA1 = MovingAverage(averageType.SIMPLE,Price,MN1);
def MA2 = MovingAverage(averageType.SIMPLE,Price,MN2);
def MA3 = MovingAverage(averageType.SIMPLE,Price,MN3);
def MA4 = MovingAverage(averageType.SIMPLE,Price,MN4);
def HJ = (Close - MA1)/MA1 + (Close - MA2)/MA2 + (Close - MA3)/MA3 + (Close - MA4)/MA4;
def MaxHJ = Highest( HJ, Lookback);
def MinHJ = Lowest( HJ, Lookback);
Plot HJOsc = if HJ > 0 then HJ / MaxHJ*100 else HJ/ MinHJ * -100;
}
Plot Upper = Threshold;
Plot Middle =0;
Plot Lower = - Threshold;
def Dist = (Upper - lower);
Plot hf = Upper - Dist * 0.236;
Plot chf = Upper - Dist * 0.382;
Def mid = Upper - Dist * 0.5;
Plot cfl = Upper - Dist * 0.618;
Plot lf = Upper - Dist * 0.764;
AddCloud(Upper,hf,Color.Light_Red);
AddCloud(lf,Lower,Color.Light_Green);
AddCloud(chf,cfl,Color.Light_Gray);
Plot s1HJOsc = SymbolHJOsc(symbol1);
Plot s2HJOsc = SymbolHJOsc(symbol2);
Plot s3HJOsc = SymbolHJOsc(symbol3);
Plot s4HJOsc = SymbolHJOsc(symbol4);
Plot s5HJOsc = SymbolHJOsc(symbol5);
Plot s6HJOsc = SymbolHJOsc(symbol6);
Plot s7HJOsc = SymbolHJOsc(symbol7);
Plot s8HJOsc = SymbolHJOsc(symbol8);
Plot s9HJOsc = SymbolHJOsc(symbol9);
Plot s10HJOsc = SymbolHJOsc(symbol10);
Plot s11HJOsc = SymbolHJOsc(symbol11);
S1HJOsc.SetdefaultColor(Color.Gray);
S2HJOsc.SetdefaultColor(Color.Light_Gray);
S3HJOsc.SetdefaultColor(Color.Cyan);
S4HJOsc.SetdefaultColor(Color.Blue);
S5HJOsc.SetdefaultColor(Color.Violet);
S6HJOsc.SetdefaultColor(Color.Plum);
S7HJOsc.SetdefaultColor(Color.Magenta);
S8HJOsc.SetdefaultColor(Color.Pink);
S9HJOsc.SetdefaultColor(Color.Red);
S10HJOsc.SetdefaultColor(Color.Yellow);
S11HJOsc.SetdefaultColor(Color.Lime);
Upper.SetDefaultColor(Color.Gray);
Middle.SetdefaultColor (Color.Black);
Lower.SetDefaultColor(Color.Gray);
hf.SetdefaultColor (Color.Gray);
chf.SetDefaultColor(Color.Gray);
cfl.SetdefaultColor (Color.Gray);
lf.SetDefaultColor(Color.Gray);
Upper.SetPaintingStrategy(PaintingStrategy.Line);
Middle.SetPaintingStrategy(PaintingStrategy.Line);
Lower.SetPaintingStrategy(PaintingStrategy.Line);
hf.SetPaintingStrategy(PaintingStrategy.Line);
chf.SetPaintingStrategy(PaintingStrategy.Line);
cfl.SetPaintingStrategy(PaintingStrategy.Line);
lf.SetPaintingStrategy(PaintingStrategy.Line);

AddLabel(1,”1:” + Symbol1 +S1HJOsc,Color.Gray);
AddLabel(1,”2:” + Symbol2 +S2HJOsc,Color.Light_Gray);
AddLabel(1,”3:” + Symbol3 +S3HJOsc,Color.Cyan);
AddLabel(1,”4:” + Symbol4 +S4HJOsc,Color.Blue);
AddLabel(1,”5:” + Symbol5 +S5HJOsc,Color.Violet);
AddLabel(1,”6:” + Symbol6 +S6HJOsc,Color.Plum);
AddLabel(1,”7:” + Symbol7 +S7HJOsc,Color.Magenta);
AddLabel(1,”8:” + Symbol8 +S8HJOsc,Color.Pink);
AddLabel(1,”9:” + Symbol9 +S9HJOsc,Color.Red);
AddLabel(1,”10:” + Symbol10 +S10HJOsc,Color.Yellow);
AddLabel(1,”11:” + Symbol11 +S11HJOsc,Color.Lime);
 

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

FYI: Here is what this indicator looks like:
a3.png
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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