Entry, Target, Profit Loss (PnL) Watchlists, Labels of Owned Equities In ThinkOrSwim

Thanks for sharing but I am confusing. Can you share with us the screen shot of your set up? My TOS is showing the working order on the chart and I did not have to do anything with this setting at all. Sorry, for some reason I can not attract the screen shot for you to see
 
I am afraid I already know the answer but in hopes that I am wrong, here is my question: Can I set up a watchlist displaying gains and losses?

The label displays correctly on my charts with no errors.

But it gives the error:

no such function getaverageprice no such function getquantity

when I attempt to load the script into a watchlist field.

Here is my custom field:
Code:
def cost = GetAveragePrice();
def qty  = GetQuantity();
def purchase = qty * cost ;
def present  =  qty * close ;
plot gainloss = present - purchase ;
gainloss.Hide();
def GLpct    = Round(gainloss / purchase, 3) ;
AddLabel(yes, "gain " + gainloss + " " + AsPercent(GLpct), if gainloss > 0 then Color.GREEN else Color.RED );

I get around the problem by keeping a detached monitor screen up. But it is a poor substitute for my watchlist which has all my stocks and sell indicators. It would be helpful to see my current gains in the field next to my sell indicators when I am making quick decisions.

How do other people get around watching all the stocks they have in play?
 
Last edited:
@MerryDay - in the watchlist 'available items' there is p/l day, p/l open, p/l percent, p/l year

On my options watchlist, my setup is - theo price, impl vol, delta, p/l open, position qty - i fond quantity most helpful as when orders get hit dont need to think about how many i have left

seems to work well
 
Thank you @codydog. I am using those fields in my watchlist along with average trade price.
I assume you are saying that I cannot use those items in calculating loss and gains the way I would like?
 
@MerryDay - not sure exactly, what you're doing, but my experience is that some folks try to shoehorn all kinds of stuff in watchlists, when a simple mental calc would solve their concerns. And i have no idea what tos resources get used for this, perhaps considering flipping this into an excel and having it update there?

I use RTD for some options stuff and it seems ok.
 
@codydog I usually have around a dozen stocks in play during the day. My holding period is anywhere from 3hrs to 3wks. I have an "Stocks in Play" watchlist w/ all the stocks I own and you are right. I shoehorn plenty into it. I have fields to alert me when they hit resistance bands, swing under or over the ATR trail, when Welkin Volume alerts, as well as labels that alert for change in zScore, Matrix slope, and IWO squeeze.

When indicators flip, I have to go to the TOS monitor and my spreadsheets to review my current position to determine profit-taking and risk assessment. I would like an "at a glance summary" all in one place.

I will chalk this up to another thing that TOS falls short on. Not knocking TOS. I have been fiddling on TradeStation; it turns out things are not always greener on the other side. Automating orders exits based on an ATR trailstop is problematic there also. I have yet to find a robust ability to track/watch gains/losses over there either. And of the most concern: I have yet to find a group that is as giving of their time and knowledge as I have enjoyed here.
 
Heeheehee... I definitely have lots of demands when it comes to watching my money. My goal is to have one place where I can see what is invested, what the current standing is, and where my indicators are pointing.

It's hard to believe that there is a greater demand for this.
It seems that many people want the holy grail to find the perfect stock to buy which is such a small part of the equation.
Stock management analysis and compound exit strategies are my keys to making a profit. It is not just TOS that falls woefully short in database portfolio analysis. My research hasn't found a trading software that is excelling in this area.

The fields are already populating the database. I have to believe that most trading systems aren't making them available because there is no demand.
We are all doing in spreadsheets, what should be easily done within the program.
 
Hello all,

I noticed some useful features on my Webull app that are missing in Thinkorswim. I have attached an image to check if its possible to add these feature on TOS windows program.

1. I would like to see: Profit/Loss dollar estimate on the chart. This changes dynamically as I move the stop loss or take profit level (OCO order).

yInMhjJ.jpg


2. I also want to see my Point of sale (POS) listed on the chart. Once my order fills, there is no mark on TOS chart to see at what level my stock was purchased at. I have to go to monitor tab or order entry to see my Trade price. I attached an image of how POS appears on Webull.

2j0RzFb.jpg


Thank you
 
Last edited by a moderator:
Thanks for the quick reply. I have tried Show trades before but its not accurate. It places a price bubble with arrow pointing to candlestick but its not the actual price level. I have to go back with price level tool to place a line at point of purchase. For example, I bought AAPL at 379.87 but the arrow points no where near 379.87. Also it shows all my previous trades which clutters up the screen if I buy and sell multiple times in a day. I have attached a screenshot of my TOS. It will be nice if it showed only the current POS price level on the chart.

U5Purd1.jpg
 
Last edited by a moderator:
@kalyan Try this code by Mobius -

Code:
# Plotting Average Actual Entry
# Mobius
# 01.01.2018

input HardStop = 3.00;
input Dir = {default long, short};

plot hide = double.nan;
     hide.setDefaultColor(Color.Black);
def c = if isNaN(close[-1]) then close else c[1];
def Entry = if isNaN(GetAveragePrice())
            then Entry[1]
            else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1]
                   then barNumber()
                   else LastEntryBar[1];
plot Entry_ = if barNumber() >= HighestAll(LastEntryBar) and Entry > 0
              then highestAll(if isNaN(close[-1])
                              then Entry
                              else double.nan)
              else double.nan;
     Entry_.SetStyle(Curve.Long_Dash);
     Entry_.SetLineWeight(3);
     Entry_.SetDefaultColor(CreateColor(255,215,0));
     Entry_.HideBubble();
     Entry_.HideTitle();
def PL = if Entry > 0 then Entry - c else 0;
AddChartBubble(barNumber() == HighestAll(barNumber()), Entry_, "AVG " +AsDollars(Entry), Entry_.TakeValueColor());
#Alert(c crosses below Entry, "", Alert.Bar, Sound.Chimes);
#Alert(c crosses above Entry, "", Alert.Bar, Sound.Ring);
plot stop;
switch (Dir)
{
case long:
    stop = Entry_ - HardStop;
case short:
    stop = Entry_ + HardStop;
}
#Alert(close crosses stop, "STOP", Alert.Bar, Sound.Bell);
# End Code

Also, try creating a watchlist and select "current account positions". Then, choose your desired columns, such as "Avg Price", "P/L %", "P/L Open", etc.
 
Thank you for the code. It is working great for the POS. I dont see "current account positions" under New watchlist.

Thanks again

iTEBZ6h.jpg
 
Still hunting. For clarity, TOS can show you the price of a purchase and sale in the platform....it has the green arrow up or down for Sale.

I am looking for something similar to when you have an order in place that shows the horizontal line of the trade executed.

Thanks!
 
Last edited by a moderator:
@wcsharron Maybe look at this post, or you could try the modified code below that I have lately been using.
Note: Please ensure that the below study plots correctly before using.

Code:
# Average Actual Entry
# Mobius
# 01.01.2018

# Removed portions of Mobius' code, added quantity and replaced Mobius' P/L
# calculation with GetOpenPL().
# Color-coded label, edited study look/colors for personal preference

def PL = GetOpenPL();
def c = if isNaN(close[-1]) then close else c[1];
def Entry = if isNaN(GetAveragePrice()) then Entry[1] else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1] then barNumber() else LastEntryBar[1];

plot Entry_ = if barNumber() >= HighestAll(LastEntryBar) and Entry > 0
              then highestAll(if isNaN(close[-1]) then Entry else double.nan) else double.nan;
     Entry_.SetStyle(Curve.SHORT_DASH);
     Entry_.SetLineWeight(3);
     Entry_.SetDefaultColor(color.BLUE);
     Entry_.HideBubble();
     Entry_.HideTitle();

AddLabel(1, "Qty: " + GetQuantity() +
         "   Avg Cost $" + Entry +
         "   P/L: " + AsDollars(PL),
         if PL == 0 then color.cyan
         else if PL > 0 then color.green
         else color.red);
# end code
 
Last edited:
I also have this problem. It works properly in paper trading, but I only get N/A in real trading. Anyone know why that might be?
 
I had the same problem, getAveragePrice was always "N/A". I contacted support via live chat and they immediately pointed me to the "Advanced Features" setting which needs to be enabled: Ameritrade.com > Client Services > My Profile > General > Advanced Features
It took a few hours to kick in, but now I get the correct values from the Portfolio functions. (y)
 
I had the same problem, getAveragePrice was always "N/A". I contacted support via live chat and they immediately pointed me to the "Advanced Features" setting which needs to be enabled: Ameritrade.com > Client Services > My Profile > General > Advanced Features
It took a few hours to kick in, but now I get the correct values from the Portfolio functions. (y)
Ha! I also figured this out a couple days ago (I think I turned it on the day I posted my reply), but forgot to update this chain. It also fixes "Show Trades" and my mobile alerts. Been a life saver. Google should have this answer more readily!

Thanks!
 

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