Repaints MTF CandleSticks of Symbol in Lower For ThinkOrSwim

Repaints

dart966

Member
VIP
Note this indicator will REPAINT due to the nature of getting data from a higher time-frame. Repaints until the selected aggregation's time period ends.

MTF Symbol in Lower (default symbol = VIX and default Chart Type = Candlesticks):

Code:
# MTF_Symbol_CandleSticks_Lower
# by dart966 on 06.07.2025

declare lower;

input customSymbol = "VIX"; # User-defined symbol
input aggregationPeriod = AggregationPeriod.FIVE_MIN;
input charttype = ChartType.CANDLE;

# Retrieve OHLC data for the input symbol
def customOpen = open(symbol = customSymbol, period = aggregationPeriod);
def customHigh = high(symbol = customSymbol, period = aggregationPeriod);
def customLow = low(symbol = customSymbol, period = aggregationPeriod);
def customClose = close(symbol = customSymbol, period = aggregationPeriod);

# Create candlesticks

# Candle/Bar trend direction logic
def UpCandle = customClose > customOpen;
def DnCandle = customClose < customOpen;
def doji = customClose == customOpen;

# GlobalColor Colors

DefineGlobalColor("UpCandle", Color.GREEN);
DefineGlobalColor("DnCandle", Color.RED);
DefineGlobalColor("Doji", Color.WHITE);

# Paint Candles using separate AddChart() function calls

AddChart(high = if UpCandle then customLow else Double.NaN, low = customHigh, open = customClose,  close = customOpen, type = ChartType.CANDLE, growcolor = GlobalColor("UpCandle"));

AddChart(high = if DnCandle then customHigh else Double.NaN, low = customLow, open = customOpen,  close = customClose, type = ChartType.CANDLE, growcolor = GlobalColor("DnCandle"));

AddChart(high = if doji then customHigh else Double.NaN, low = customLow, open = customOpen,  close = customClose, type = ChartType.CANDLE, growcolor = GlobalColor("Doji"));


# end script
 
Last edited:

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

interesting use of addchart()

here is one of mine , and 10 pages of similar studies
https://usethinkscript.com/threads/...verlay-for-thinkorswim.1425/page-4#post-71874 post 74


i added this to your code , to display the symbol and agg time

Code:
addlabel(1, customSymbol, color.cyan);

#def agg2 = GetAggregationPeriod();
def agg2min =  aggregationPeriod / 60000;
AddLabel(yes, "AGG " + if agg2min < 60 then (agg2min + " m")
              else if agg2min < 1440 then ((agg2min / 60) + " H")
              else if agg2min < 10080 then (agg2min / (60 * 24) + " D")
              else if aggregationPeriod == AggregationPeriod.WEEK then "W"
              else if aggregationPeriod == AggregationPeriod.MONTH then "M"
              else "", Color.CYAN);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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