getaverageprice() getquantity()

MerryDay

MerryDay

Member
VIP
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

MerryDay

Member
VIP

Here is how the label displays on my charts and how I want it to display on my watchlist.
 
C

codydog

Active member
@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
 
MerryDay

MerryDay

Member
VIP
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?
 
C

codydog

Active member
@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.
 
MerryDay

MerryDay

Member
VIP
@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.
 
C

codydog

Active member
@MerryDay - My needs are much simpler - perhaps consider a Bloomberg if your needs are that extensive.
 
MerryDay

MerryDay

Member
VIP
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.
 
Top