Dot Indicator for ThinkorSwim

harsh23197

New member
VIP
can anyone look at this video and code this kind of indicator. They explain how the indicator works but i dont know how to code it.
 
Solution
can anyone look at this video and code this kind of indicator. They explain how the indicator works but i dont know how to code it.

usually , this isn't how it works. it's up to you to do the homework. it's your job to watch videos and take notes and write down rules that a program should follow. anyone can do this.

this seemed simple, so i just did it.
the video mentioned some number for each stock ( 0.4) , but didn't explain them so i didn't add them.

-----------------

rules....
look up prices for 6 stocks
compare each stock price on current bar to the previous bar.
. if price increased then add to up count.
. if price decreased then add to down count.
if a count is >= 4 then plot a dot

up dots are...
can anyone look at this video and code this kind of indicator. They explain how the indicator works but i dont know how to code it.

usually , this isn't how it works. it's up to you to do the homework. it's your job to watch videos and take notes and write down rules that a program should follow. anyone can do this.

this seemed simple, so i just did it.
the video mentioned some number for each stock ( 0.4) , but didn't explain them so i didn't add them.

-----------------

rules....
look up prices for 6 stocks
compare each stock price on current bar to the previous bar.
. if price increased then add to up count.
. if price decreased then add to down count.
if a count is >= 4 then plot a dot

up dots are cyan, and below bar
down dot are magenta, and above bar

Code:
# index_major_stocks_trends
#https://usethinkscript.com/threads/dot-indicator-for-thinkorswim.20362/
#Dot Indicator for ThinkorSwim

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

# symbols
input sym1 = "AAPL";
input sym2 = "MSFT";
input sym3 = "NVDA";
input sym4 = "AMZN";
input sym5 = "GOOGL";
input sym6 = "META";

# close prices
def c1 = close(sym1);
def c2 = close(sym2);
def c3 = close(sym3);
def c4 = close(sym4);
def c5 = close(sym5);
def c6 = close(sym6);

# directions
def d1 = if c1 > c1[1] then 1 else if c1 < c1[1] then -1 else 0;
def d2 = if c2 > c2[1] then 1 else if c2 < c2[1] then -1 else 0;
def d3 = if c3 > c3[1] then 1 else if c3 < c3[1] then -1 else 0;
def d4 = if c4 > c4[1] then 1 else if c4 < c4[1] then -1 else 0;
def d5 = if c5 > c5[1] then 1 else if c5 < c5[1] then -1 else 0;
def d6 = if c6 > c6[1] then 1 else if c6 < c6[1] then -1 else 0;


input min_qty = 4;

# sum of directions
def upcnt = (d1>0)+(d2>0)+(d3>0)+(d4>0)+(d5>0)+(d6>0);
def dwncnt = (d1<0)+(d2<0)+(d3<0)+(d4<0)+(d5<0)+(d6<0);

def isgrn = upcnt >= min_qty;
def isred = dwncnt >= min_qty;

def y = 0.008;
# up = cyan dot below bars
plot zup = if isgrn then (low*(1-y)) else na;
zup.SetPaintingStrategy(PaintingStrategy.POINTS);
#zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.cyan);
zup.setlineweight(3);
zup.hidebubble();


# down = purple dot above bars
plot zdwn = if isred then (high*(1+y)) else na;
zdwn.SetPaintingStrategy(PaintingStrategy.POINTS);
#zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdwn.SetDefaultColor(Color.magenta);
zdwn.setlineweight(3);
zdwn.hidebubble();


input test1_close = no;
addchartbubble(test1_close, low*0.99,
c1 + "\n" + 
c2 + "\n" + 
c3 + "\n" + 
c4 + "\n" + 
c5 + "\n" + 
c6 + "\n" 
, color.yellow, no);


input test2_dir = no;
addchartbubble(test2_dir, low*0.99,
 upcnt + " U\n" + 
 dwncnt + " D\n" +
 d1 + "\n" + 
 d2 + "\n" + 
 d3 + "\n" + 
 d4 + "\n" + 
 d5 + "\n" + 
 d6 + "\n" 
, color.yellow, no);
#
 

Attachments

  • pic.JPG
    pic.JPG
    36.8 KB · Views: 125
Solution

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
370 Online
Create Post

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