Trin and Tick Labels For ThinkOrSwim

followthemoneyb

New member
I'm looking to get the trin and tick symbols into labels to go on the chart. $TICKC(over 250 green, under250 red, middle white) $TICKC/Q(over 350 green under 350 red) TIKSPC, (over 150 green under 150 red)

$TRINC, $TRINC/Q, $TRINSPC (value over 1 red value under 1 green for all trin)

I think this makes sence any help would be appreciated. thanks
 

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

I found it somewhere in the web. You can try it.

def trinDailyClose = close(symbol = "$TRIN", period = AggregationPeriod.DAY)[1];
AddLabel(yes, trinDailyClose, if trinDailyClose > 2.0 then Color.GREEN else if trinDailyClose > 0.5 then Color.GRAY else Color.RED);
 
These you can just reuse on the same chart with different settings,

Code:
Input Sym = "$TICK";
Input Upper = 250;
Input Lower = -250;
def Val = Close(Sym);
AddLabel(
    Yes,
    Sym + ": " + Val,
    if Val > Upper then color.green
    else if Val < Lower then Color.red
    else Color.white
);

Code:
Input Sym = "$TRIN";
Input Center = 1;
def Val = Close(Sym);
AddLabel(
    Yes,
    Sym + ": " + Val,
    if Val > Center then color.red
    else Color.green
);
 
These you can just reuse on the same chart with different settings,

Code:
Input Sym = "$TICK";
Input Upper = 250;
Input Lower = -250;
def Val = Close(Sym);
AddLabel(
    Yes,
    Sym + ": " + Val,
    if Val > Upper then color.green
    else if Val < Lower then Color.red
    else Color.white
);

Code:
Input Sym = "$TRIN";
Input Center = 1;
def Val = Close(Sym);
AddLabel(
    Yes,
    Sym + ": " + Val,
    if Val > Center then color.red
    else Color.green
);
How do you add moving average to smooth the Trin data?
 
Yes, it updates in real time.



You could do something like;

Code:
def Val = Average(Close(Sym),20);

or

Code:
Input Length = 20;
def Val = Average(Close(Sym),Length);

however you want really...
@Joshua How would you go about referencing the 5 period SMA on a 5min chart for that label? I've played around with the code and tried to incorportate AggregationPeriod.FIVE_MIN in a few different spots, but can't seem to get it right. (looking at a TICK label, not TRIN). Thanks.
 
It goes in close,

Close( period = AggregationPeriod.FIVE_MIN )

Average( Close( period = AggregationPeriod.FIVE_MIN ) , 5 )

If that doesn't solve your problem let me know, I can take a more detailed look at it.
 
@Joshua That makes the label show the 5min 5sma value of the current ticker that the chart is on. How would you reference the Tick symbol with that code to pull the Tick symbol data, rather than whatever ticker the chart is currently showing? I tried to put it within the Val definition but couldn't get it to work without showing an error.

Input Sym = "$TICK";
Input Upper = 250;
Input Lower = -250;
def Val = Average(Close(period = AggregationPeriod.FIVE_MIN),5);

AddLabel(
Yes,
Sym + ": " + Val,
if Val > Upper then color.green
else if Val < Lower then Color.red
else Color.white
);
 
hard coded:
def Val = Average(Close("$TICK", AggregationPeriod.FIVE_MIN),5);

via input:
def Val = Average(Close(Sym, AggregationPeriod.FIVE_MIN),5);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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