ThinkScript Portfolio Functions Broken? - futures io
futures io futures trading

ThinkScript Portfolio Functions Broken?

Discussion in ThinkOrSwim

    1. trending_up 2,426 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 1 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

ThinkScript Portfolio Functions Broken?

(login for full post details)
  #1 (permalink)
Houston Texas
Posts: 2 since Sep 2016
Thanks: 0 given, 0 received


Has anyone had success with the ThinkScript Portfolio functions? GetAveragePrice(), GetQuantity(), or GetOpenPL()? TOS keeps giving me no such function errors when trying to use them.

I'm trying to make a simple script on a watchlist or marketwatch column that takes the OpenPL / Trade Price * 100 so I can easily see the % of profits for my covered calls and naked puts so I know if I should close them out if I get good gains and have plenty of DTE. Problem is that I can't seem to get any qty, price, or PL data from my current positions (though I can get all kinds of other data). Is this possible or does TOS have these functions locked down? If so, does anyone know of a clever workaround?

Any help would be greatly appreciated! Thanks!

Reply With Quote

Can you help answer these questions
from other members on futures io?
Work with historical tcks data on MUltichart NET PowerLa …
If ES tracks SPX, why do support/resistance, Level 2, vo …
Emini and Emicro Index
Short Interest Ratio indicator?
What blockvolume is visible? - order processing
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
Best Threads (Most Thanked)
in the last 7 days on futures io
Selling Options on Futures?
109 thanks
Battlestations: Show us your trading desks!
108 thanks
Rank your Futures vs Stocks trading priority
55 thanks
Want your NinjaTrader indicator created, free?
27 thanks
Whats this confusion with margins?
23 thanks
(login for full post details)
  #2 (permalink)
Houston Texas
Posts: 2 since Sep 2016
Thanks: 0 given, 0 received

Ok, I figured out that the portfolio functions only work in custom studies for the chart. I've got my percentage showing as a label on the chart, but anyone know of a way to get it into a column on the watchlist or marketwatch grids? I can't use those functions or my custom study outside of the chart for some reason. It's silly, because I can add the individual fields that I want to the MarketWatch grid, I just can't use any of those fields for calculation.

Reply With Quote
(login for full post details)
  #3 (permalink)
Posts: 1 since Aug 2017
Thanks: 0 given, 0 received

As a test of the function GetAveragePrice, I generated this ThinkOrSwim script
def AP = GetAveragePrice();
plot AP_ = AP;

Here's the script.
The output for AP doesn't make any sense.
Does anyone understand it?

Attached Thumbnails
Click image for larger version

Name:	TOS_Study_GetAveragePrice.jpg
Views:	188
Size:	136.9 KB
ID:	240172  
Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > ThinkScript Portfolio Functions Broken?

Last Updated on August 15, 2017

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Battlestations! Show us your trading desk - $1,500 in prizes!


Importance of Finding Your Own Way w/Adam Grimes

Elite only

Journal Challenge w/Jigsaw


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts