Looking for help building Linda's NYSE $TICK indicator on tos

SixVix

New member
I saw this post on twitter from Linda Raschke and the indicator she built shows the Moving Average of the NYSE $TICK highs on the top and the lows on the bottom of her $TICK chart.
Screenshot_20250827_094505_X.jpg

If anyone can help build this would greatly appreciate it.

Screenshot_20250827_094505_X1.jpg
 
Last edited by a moderator:
I saw this post on twitter from Linda Raschke and the indicator she built shows the Moving Average of the NYSE $TICK highs on the top and the lows on the bottom of her $TICK chart.

If anyone can help build this would greatly appreciate it.

sorry for delay, i hurt my foot and couldn't get upstairs to my computer.


this draws 2 averages, (EMA5) above and below the main candles.
the top average is of the high prices.
the bottom average is of the low prices.
there is a factor variable to change the offset of them if needed.

it finds the gap between the 2 average lines.
then looks for the smallest gap and biggest gap, within x bars of current bar. default is +-7bars.

it draws a green cloud on biggest gaps, and red clouds on smallest gaps.

tested with $TICK
if using this on a stock, change the factor1 variable, to something like -0.9.

Code:
#avgs_hilo_boxes

#https://usethinkscript.com/threads/looking-for-help-building-lindas-nyse-tick-indicator-on-tos.21503/
#Looking for help building Linda's NYSE $TICK indicator on tos
#SixVix  9/15
#1
#I saw this post on twitter from Linda Raschke and the indicator she built shows the Moving Average of the NYSE $TICK highs on the top and the lows on the bottom of her $TICK chart.


#----------------------

def bn = barnumber();
def na = double.nan;

def lastbn = HighestAll(if IsNaN(close) then 0 else bn);
def lastbar = bn == lastbn;

input top_avg_length = 5;
input top_type = AverageType.exponential;
def top_avg = MovingAverage(top_type, high, top_avg_length);

input bottom_avg_length = 5;
input bottom_type = AverageType.exponential;
def bottom_avg = MovingAverage(bottom_type, low, bottom_avg_length);

# find:  hi,lo of stk.  lo of top avg.  hi of bot avg
# calc spacing of avgs away from stock
def stkhi;
def stklo;
def top_lo;
def bot_hi;
if bn == 1 then {
 stkhi = highestall(high);
 stklo = lowestall(low);
 top_lo = lowestall(top_avg); 
 bot_hi = highestall(bottom_avg);
} else {
 stkhi = stkhi[1];
 stklo = stklo[1];
 top_lo = top_lo[1];
 bot_hi = bot_hi[1];
}

# find diff from stk highest to avg
def topgap = stkhi - top_lo;
def botgap = stklo - bot_hi;

# calc spacing, avg lines to stock bars
input factor1 = 0.0;
#hint factor1: Enter a negative number to move average lines closer to main candles (ex. -0.8)

plot ztopavg = top_avg + (topgap * (1 + factor1));
plot zbotavg = bottom_avg + (botgap * (1 + factor1));
ztopavg.SetDefaultColor(Color.cyan);
ztopavg.setlineweight(1);
ztopavg.hidebubble();
zbotavg.SetDefaultColor(Color.yellow);
zbotavg.setlineweight(1);
zbotavg.hidebubble();

#------------------------
#  find gaps, from top avg to bottom avg, biggest(green) and smallest(red) ,
#  use peak/valley code

def avg_gap = ztopavg - zbotavg;
def highx = avg_gap;
def lowx = avg_gap;
input min_max_length = 7;

def offset = Min(min_max_length - 1, lastbn - bn);
def peak = highx > Highest(highx[1], min_max_length - 1) and highx == GetValue(Highest(highx, min_max_length), -offset);
def valley = lowx < Lowest(lowx[1], min_max_length - 1) and lowx == GetValue(Lowest(lowx, min_max_length), -offset);

plot zhi = if 0 and peak then high*1.001 else na;
plot zlo = if 0 and valley then low*0.999 else na;
zlo.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zlo.SetDefaultColor(Color.red);
zlo.setlineweight(1);
zlo.hidebubble();
zhi.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zhi.SetDefaultColor(Color.green);
zhi.setlineweight(1);
zhi.hidebubble();


#  draw clouds
# define 3 bars, 1 on each side of peak/valley, for cloud
def grn = (peak[1] or peak[0] or peak[-1]);
def red = (valley[1] or valley[0] or valley[-1]);
def grntop = if grn then ztopavg else na;
def redtop = if red then ztopavg else na;

addcloud(grntop, zbotavg, color.green);
addcloud(redtop, zbotavg, color.red);

# ------------------
# test stuff
#  addverticalline(grn, "-", color.green);
#-------------------
# refs
#  peak valley code
#  https://usethinkscript.com/threads/zigzag-high-low-with-supply-demand-zones-for-thinkorswim.172/#post-7048
#  post10 - Robert Payne
#
 

Attachments

  • img3- len7.JPG
    img3- len7.JPG
    134.1 KB · Views: 77
  • img4-len14.JPG
    img4-len14.JPG
    145.1 KB · Views: 73
  • img5-len35.JPG
    img5-len35.JPG
    178.3 KB · Views: 76

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
472 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