Combining best of both setups (chart + watch list)

Charts are helpful in capturing trend over time. Watch lists are helpful in capturing snapshots of multiple symbols. Can we combine these attributes in one chart? For example, daily 5/13 ema crossover may signal down/up trend for a particular stock and it can be plotted as a red / green green dot. We can plot ten symbols like ( MSFT, AAPL, AMD, TSLA, SPY, QQQ, MU, NVDA, NFLX, FB) in a chart. A major sell off or bouncing back or recovery after pull back can be easily spotted in the chart. This may be called dashboard. Can anyone help in this development of thinkscript. We can explore different criteria for red dots or green dots.
 
@samiranadhikari Ah, that's different then. You can absolutely create your own portfolio/index that you'd like to watch. Here's one such version from Mobius that I have in my files, feel free to play with this as needed. Read the comments in the code. Since this was posted 3 years ago, you may wish to revise the weightings. It's a good template to base any future work from

Code:
# My Index
# Mobius
# 7.19.2016

# Here is an index I use. You will need to decided on how you want you symbols weighted.

input Plot_Close = yes;
input MA_Type = AverageType.Hull;
input Plot_MA = yes;
input MA_Length = 8;

script Scale {
    input c = close;
    input Min = 0;
    input Max = 0;
    def hh = HighestAll(c);
    def ll = LowestAll(c);
    plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
}

def cC = ((close("GOOGL") *  .276) +
          (close("BRK/B") *  .986) +
          (close("AAPL")  * 2.203) +
          (close("FB")    * 1.150) +
          (close("XOM")   * 1.670) +
          (close("JNJ")   * 1.109) +
          (close("MSFT")  * 3.162) +
          (close("PG")    * 1.071) +
          (close("WFC")   * 2.042) +
          (close("CHL")   * 1.647) +
          (close("JPM")   * 1.471) +
          (close("NVS")   *  .957) +
          (close("WMT")   * 1.265) +
          (close("PTR")   *  .736) +
          (close("GE")    * 3.753));
def min = LowestAll(close);
def max = HighestAll(close);
plot c = Scale(c = cC, min = min, max = max);
c.SetHiding(!Plot_Close);
c.AssignValueColor(if c >= c[1] then color.cyan else color.yellow);
plot MA = if Plot_MA
          then MovingAverage(AverageType = MA_Type, c, Ma_Length)
          else double.nan;
MA.AssignValueColor(if MA >= MA[1] then color.cyan else color.yellow);
# End Code
 
@markos Nope, those are local variables used within the script() function used as a placeholder. and are overwritten when the actual variables are passed from the actual function call. Besides Mobius doesn't make this sort of mistakes!

To help you better understand this, I have written a simple script to illustrate this. The result that is plotted is 8000 as we'd expect. Good question though. I literally had the same question when I first dabbled in the script() function years ago.

Code:
def x = 2000;
def y = 8000;

declare lower;

script MaxMin {
    input min = 10;
    input max = 20;

    plot result = Max(min,max);
}

plot c = MaxMin(min = x, max = y);
# End Code
 
Last edited:

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