Plotting 2 Symbols on Same Chart in ThinkOrSwim

Steven723

New member
Hi,

Any idea how to create an indicator that will show the total volume for 2 or more composite symbols.

Currently ToS only shows the minimum volume of the symbols you add together instead of there sum.

For example, I want to show the total volume for XLK+XLF.
 

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

Hi,

Any idea how to create an indicator that will show the total volume for 2 or more composite symbols.

Currently ToS only shows the minimum volume of the symbols you add together instead of there sum.

For example, I want to show the total volume for XLK+XLF.
You didn't provide a script. So no one can say where you went astray.
The syntax to add the volume of 2 or more composite symbols together is:
Ruby:
(volume("XLk", period = "Day") + volume("XLf", period = "Day")
XEmWbSJ.png

Ruby:
AddLabel(yes,
"Volume XLk: " +volume("XLk", period = "Day") +" | "+
"Volume XLf: " +volume("XLf", period = "Day") +" | "+
"Combined Volume: " +(volume("XLk", period = "Day") + volume("XLf", period = "Day")), color.blue);

plot XLKvol = volume("XLk", period = "Day");
plot XLfvol = volume("XLf", period = "Day");
 
Looking to make an indicator that plots 3 lines that track the movement of $ADD $TICK and $VOLD on the 15min chart. I will repay by posting strategies and my own indicators regardless if I get help on this or not. Gotta pull weight, im the new guy
 
Looking to make an indicator that plots 3 lines that track the movement of $ADD $TICK and $VOLD on the 15min chart. I will repay by posting strategies and my own indicators regardless if I get help on this or not. Gotta pull weight, im the new guy
Do you mean something like this? This gives you the logic to plot lines for 2 internal tickers. You should have no problem adding the 3rd.
wy8fTDt.png

Code:
## NormalizedSymbols by linus
# modified for Lounge request fibfibsomethingorother to compare internal tickers
#Originally version for US Sector SPDR ETFs
#hint: Normalize plots for various symbols to each other and start ploting the symbols at 0.

declare lower;

input firstSymbol  = "$ADD";
input secondSymbol = "$TICK";

def first  = close(firstSymbol);
def second = close(secondSymbol);
def na     = Double.NaN;

script normalize {
    input data = close;
    input Min = -10000;
    input Max = 10000;
    def h = HighestAll(data);
    def l = LowestAll(data);
   
    plot
    normalize = (((Max - Min) * (data - l)) / (h - l)) + Min;
}

def one = CompoundValue(1, if   !IsNaN(first)
                           then normalize(first)
                           else one[1], na);
def two = CompoundValue(1, if   !IsNaN(second)
                           then normalize(second)
                           else one[1], na);

# States: 0 = Not initialized, 1 = Initialized.
def st = {default "0", "1"};
# Offsets:
def ofst1;
def ofst2;

if st[1] == st."0" {
if !IsNaN(one) && !IsNaN(two)
{
# All recs must have a valid value before offsets are initialized to starting value, for respective symbols.
ofst1 = one;
ofst2 = two;
st = st."1";

} else {

# Not initialized.
ofst1 = na;
ofst2 = na;
st = st[1];
}
   
} else {

    ofst1 = ofst1[1];
    ofst2 = ofst2[1];
    st = st[1];
}

def ok = !IsNaN(close) and st == st."1";
plot firstSym  = if ok then one - ofst1 else na;
plot secondSym = if ok then two - ofst2 else na;
firstSym.SetDefaultColor(Color.plum);
secondSym.SetDefaultColor(Color.dark_orange);
 
Is it possible to Plot VIX and SPX on the same chart? Or even any 2 market symbols? THX
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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