Need Help to develop a tick indicator for MAG7 stocks

BETrader

New member
Plus
Dear Thinkscript community,

I have developped this script for ticks (based on same indicator developped by simpler trading):


I would like to modify this code to have the same thing with the MAG7 stocks: AAPL, AMZN, GOOGL, META, MSFT, NVDA, TSLA. Could you please help me ? I am a newbie with Thinkscript !
Many thanks in advance for your help

Code:
declare lower;
input TICK_Symbol = {default "$TICK", "$TICKC", "$TIKSP", "$TIKSPC", "$TIKND", "$TICKC/Q", "$TIKNDC", "$TICK/Q", "$TIKRL", "$TIKI", "$TIKA", "$TICKAC", "$TICKAR", "$TICKARC", "$TIKIC", "$TIKRLC", "$TIKUS", "$TIKUSC"};
input SMA_High_extreme = 300; #Limit High for SMA Ticks - Overbought
input SMA_Low_extreme = -300; #Limit Low for SMA Ticks - Oversold
input TICK_High_extreme = 800; #Limit High for Ticks - Overbought
input TICK_Low_extreme = -800; #Limit Low for Ticks - Oversold.
input Moving_Average_Length = 5; #Moving Average Length
input Moving_Average_Type = AverageType.SIMPLE;
input Average_Price = {default hlc3, close};
input TICK_Histogram_Size = 1;
input TICK_Points_Size = 4;
input Show_TICK_close = {default "NO", "YES"};

#Ticks Colors
DefineGlobalColor("QuietTicks", Color.LIGHT_GRAY);
DefineGlobalColor("TickAverage", Color.CYAN);
DefineGlobalColor("TickHighBars", Color.DARK_GREEN);
DefineGlobalColor("TickTurbo", Color.Magenta);
DefineGlobalColor("TickLowBars", Color.DARK_RED);
DefineGlobalColor("TickAverageHighExtreme", Color.RED);
DefineGlobalColor("TickAverageLowExtreme", Color.YELLOW);
DefineGlobalColor("TickClose", Color.WHITE);

def tickdata;

switch (Average_Price) {
case hlc3:
tickdata = hlc3(TICK_Symbol);
case close:
tickdata = close(TICK_Symbol);
}

def Moving_Average = MovingAverage(Moving_Average_Type, tickdata, Moving_Average_Length);

#Plots 0 line (style = line)
plot ZeroLine = 0;

ZeroLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ZeroLine.SetLineWeight(1);
ZeroLine.SetDefaultColor(Color.WHITE);
ZeroLine.SetStyle(Curve.FIRM);

#Plots Up limit for $TICK (+600) (style = line)
plot TICKLimitUP = 600;

TICKLimitUP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitUP.SetLineWeight(1);
TICKLimitUP.SetDefaultColor(Color.GREEN);
TICKLimitUP.SetStyle(Curve.FIRM);

#Plots Down limit for $TICK (-600) (style = line)
plot TICKLimitDN = -600;

TICKLimitDN.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitDN.SetLineWeight(1);
TICKLimitDN.SetDefaultColor(Color.RED);
TICKLimitDN.SetStyle(Curve.FIRM);

#Plots Medium limit Up for $TICK (+800) (style = line)
plot TICKLimitMediumUP = 800;

TICKLimitMediumUP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitMediumUP.SetLineWeight(1);
TICKLimitMediumUP.SetDefaultColor(Color.RED);
TICKLimitMediumUP.SetStyle(Curve.FIRM);

#Plots Medium limit Down for $TICK (-800) (style = line)
plot TICKLimitMediumDN = -800;

TICKLimitMediumDN.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TICKLimitMediumDN.SetLineWeight(1);
TICKLimitMediumDN.SetDefaultColor(Color.GREEN);
TICKLimitMediumDN.SetStyle(Curve.FIRM);

#Plots Moving Average (style = line)
#plot MovingAverage = if !IsNaN(Moving_Average) then Moving_Average else Double.NaN;
plot TickAverage = if !IsNaN(Moving_Average) then Moving_Average else Double.NaN;

TickAverage.SetPaintingStrategy(PaintingStrategy.LINE);
TickAverage.SetLineWeight(2);
TickAverage.SetDefaultColor(Color.CYAN);
TickAverage.SetStyle(Curve.FIRM);

#Plots High of $TICK (style = histogram)
plot TickHigh = if high(TICK_Symbol) >= 0 then high(TICK_Symbol) else 0;

TickHigh.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TickHigh.AssignValueColor(if high(TICK_Symbol) >= SMA_High_extreme then GlobalColor("TickHighBars") else GlobalColor("QuietTicks"));
TickHigh.SetLineWeight(TICK_Histogram_Size);

#Plots Low of $TICK (style = histogram)
plot TickLow = if low(TICK_Symbol) <= 0 then low(TICK_Symbol) else 0;

TickLow.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TickLow.AssignValueColor(if low(TICK_Symbol) <= SMA_Low_extreme then GlobalColor("TickLowBars") else GlobalColor("QuietTicks"));
TickLow.SetLineWeight(TICK_Histogram_Size);

#Plots High Max of $TICK (style = point) if High Max >= TICK_High_extreme
plot TickHighExtreme = if high(TICK_Symbol) >= TICK_High_extreme then high(TICK_Symbol) else Double.NaN;

TickHighExtreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
TickHighExtreme.SetLineWeight(TICK_Points_Size);
TickHighExtreme.SetDefaultColor(GlobalColor("TickTurbo"));

#Plots Low Max of $TICK (style = point) if Low Min <= TICK_Low_extreme
plot TickLowExtreme = if low(TICK_Symbol) <= TICK_Low_extreme then low(TICK_Symbol) else Double.NaN;

TickLowExtreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
TickLowExtreme.SetLineWeight(TICK_Points_Size);
TickLowExtreme.SetDefaultColor(GlobalColor("TickTurbo"));

#Plots High Max of SMA (style = point) if Moving_Average >= SMA_High_extreme
plot MovingAveragehigh_extreme = if Moving_Average >= SMA_High_extreme then Moving_Average else Double.NaN;

MovingAveragehigh_extreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MovingAveragehigh_extreme.SetLineWeight(TICK_Points_Size);
MovingAveragehigh_extreme.SetDefaultColor(GlobalColor("TickAverageHighExtreme"));

#Plots Low Min of $TICK (style = point) if Moving_Average <= SMA_Low_extreme
plot MovingAveragelow_extreme = if Moving_Average <= SMA_Low_extreme then Moving_Average else Double.NaN;

MovingAveragelow_extreme.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MovingAveragelow_extreme.SetLineWeight(TICK_Points_Size);
MovingAveragelow_extreme.SetDefaultColor(GlobalColor("TickAverageLowExtreme"));

#Plots $TICK close
plot TICKclose = if Show_TICK_close and !IsNaN(close(TICK_Symbol)) then close(TICK_Symbol) else Double.NaN;

TICKclose.SetPaintingStrategy(PaintingStrategy.POINTS);
TICKclose.SetLineWeight(1);
TICKclose.SetDefaultColor(GlobalColor("TickClose"));

#END
 

Attachments

  • Ticks.png
    Ticks.png
    42.2 KB · Views: 25
Last edited by a moderator:
Solution
Individual stocks and the Mag7 do not have TICKs.
Code:
# TICK
# Symbol  | Symbol
# Primary | Composite | Description
# $TIKI   # $TIKIC    | DJIA TICK
# $TIKND  # $TIKNDC   | NASDAQ 100 TICK
# $TIKSP  # $TIKSPC   | SNP 500 TICK
# $TIKRL  # $TIKRLC   | RUSSELL 2000 TICK
# $TIKUS  # $TIKUSC   | AllUSA TICK
# $TICK/Q # $TICK/QC  | NASDAQ TICK
# $TICK   # $TICKC    | NYSE TICK
Individual stocks and the Mag7 do not have TICKs.
Code:
# TICK
# Symbol  | Symbol
# Primary | Composite | Description
# $TIKI   # $TIKIC    | DJIA TICK
# $TIKND  # $TIKNDC   | NASDAQ 100 TICK
# $TIKSP  # $TIKSPC   | SNP 500 TICK
# $TIKRL  # $TIKRLC   | RUSSELL 2000 TICK
# $TIKUS  # $TIKUSC   | AllUSA TICK
# $TICK/Q # $TICK/QC  | NASDAQ TICK
# $TICK   # $TICKC    | NYSE TICK
 
Solution

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