Show Monitor Tab Info on Charts

CallMeJD

New member
Hi, I’m a medium term stock swing trader. One of my frustrations with ToS is that when I’m looking at a chart for a position I hold and determining if I should Add or Reduce/Sell, I want to see the position information from the Monitor tab. I’m constantly toggling back and forth between those 2 tabs and it occurred to me I could probably use thinkscript to show that info on the chart. I am specifically looking for:
  • # of shares
  • Trade price
  • Net Liq
  • P/L%
  • P/L Open
I'm hoping someone can point me to an example of something similar that I can adapt.

Thanks in advance for any help and I'm posting a mockup of what I'm looking for below. (I am not looking for this formatting, just a way to see the info for an active position.)
Screenshot 2024-02-09 at 9.02.41 AM.png
 
Hi, I’m a medium term stock swing trader. One of my frustrations with ToS is that when I’m looking at a chart for a position I hold and determining if I should Add or Reduce/Sell, I want to see the position information from the Monitor tab. I’m constantly toggling back and forth between those 2 tabs and it occurred to me I could probably use thinkscript to show that info on the chart. I am specifically looking for:
  • # of shares
  • Trade price
  • Net Liq
  • P/L%
  • P/L Open
I'm hoping someone can point me to an example of something similar that I can adapt.

Thanks in advance for any help and I'm posting a mockup of what I'm looking for below. (I am not looking for this formatting, just a way to see the info for an active position.)
View attachment 21077I am new to trading and also share your frustration. From the looks, brokerage firms put enough on these tools but not enough for you to compete with the same tools.
ThinkScript does not have direct access to dynamically load real-time account or position-specific information such as number of shares held, trade price, net liquidation value, and profit/loss percentages. This is largely due to security and design limitations to ensure that scripts running on charts cannot directly interact with sensitive account data.

The platform is designed to separate trading functions and scripting for indicators and strategies to maintain security and integrity. While this ensures that scripts cannot accidentally or maliciously affect your trading positions, it also means that traders cannot automate or script dynamic displays of their account or position data directly on the charts. The most I have is a manual entry for large items I'd be happy to share BELOW:
# Using input fields to allow for easy adjustments from the chart interface

input numberOfShares = 100;
input tradePrice = 50.25;
input netLiq = 5025; # You can manually adjust this or automate based on the trade price and number of shares
input plPercent = 10; # Percent profit or loss
input plOpen = 502.50; # Open profit or loss

# Add labels to display the data on the chart
AddLabel(yes, "Shares: " + numberOfShares, Color.WHITE);
AddLabel(yes, "Trade Price: $" + tradePrice, Color.WHITE);
AddLabel(yes, "Net Liq: $" + netLiq, Color.WHITE);
AddLabel(yes, "P/L %: " + plPercent + "%", Color.WHITE);
AddLabel(yes, "P/L Open: $" + plOpen, Color.WHITE);
 

Attachments

  • TOS TAB.png
    TOS TAB.png
    22.7 KB · Views: 17
Hi, I’m a medium term stock swing trader. One of my frustrations with ToS is that when I’m looking at a chart for a position I hold and determining if I should Add or Reduce/Sell, I want to see the position information from the Monitor tab. I’m constantly toggling back and forth between those 2 tabs and it occurred to me I could probably use thinkscript to show that info on the chart. I am specifically looking for:
  • # of shares
  • Trade price
  • Net Liq
  • P/L%
  • P/L Open
I'm hoping someone can point me to an example of something similar that I can adapt.

Thanks in advance for any help and I'm posting a mockup of what I'm looking for below. (I am not looking for this formatting, just a way to see the info for an active position.)
View attachment 21077
 
I just noticed sending the older file. heres the most recent script to copy.
Best,
Carlos

# User Inputs for data not available from chart directly
input numberOfShares = 100; # Default example, user needs to input actual shares
input tradePrice = 50.25; # Default trade price, user inputs actual purchase price

# Calculations based on user input and current price
def currentPrice = close; # Current market price from chart
def currentPositionValue = numberOfShares * currentPrice;
def costBasis = numberOfShares * tradePrice;
def plOpen = currentPositionValue - costBasis;
def plPercent = (plOpen / costBasis) * 100;
def netLiq = currentPositionValue;

# Display Labels
AddLabel(yes, "Shares: " + numberOfShares, Color.WHITE);
AddLabel(yes, "Trade Price: $" + tradePrice, Color.WHITE);
AddLabel(yes, "Current Price: $" + currentPrice, Color.YELLOW);
AddLabel(yes, "Net Liq: $" + netLiq, Color.CYAN);
AddLabel(yes, "P/L %: " + AsPercent(plPercent / 100), if plPercent >= 0 then Color.GREEN else Color.RED);
AddLabel(yes, "P/L Open: $" + plOpen, if plOpen >= 0 then Color.GREEN else Color.RED);
 

Attachments

  • Screenshot 2024-05-12 173258.png
    Screenshot 2024-05-12 173258.png
    378.5 KB · Views: 24

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