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

After placing an order I see the green buy in pointer but it gets confusing on the right location of the buy in when I have many things going on.

Can TOS place a line going from right to left to the buy in area to make it more easy to see so when moving the stop I can see a line for the buy in area more easy.
See second image I drew the white line to the buy in area can this be auto added in for each buy?
I have added in the gray line (more easy to see on second image) that shows the current price and the two others on top and bottom of the gray are the price gap so all that moves with the price up and down.

Screenshot 2024-10-03 at 1.15.51 PM.png


Screenshot 2024-10-03 at 1.20.19 PM.png
 
Last edited by a moderator:
After placing an order I see the green buy in pointer but it gets confusing on the right location of the buy in when I have many things going on.

Can TOS place a line going from right to left to the buy in area to make it more easy to see so when moving the stop I can see a line for the buy in area more easy.
See second image I drew the white line to the buy in area can this be auto added in for each buy?
I have added in the gray line (more easy to see on second image) that shows the current price and the two others on top and bottom of the gray are the price gap so all that moves with the price up and down.

https://usethinkscript.com/threads/...quities-in-thinkorswim.7089/page-6#post-77993
 
Current P/L Status
I tweaked the 1st post to include how many days ago that I bought a stock.
Helps me see the dogs in my portfolio
View attachment 12056
Ruby:
# Current P/L Status
input value = .07;
def avg = getaveragePrice();
def AreYouIn = if getquantity() != 0 then yes else no;

def targetprice02 = (avg) - (value*2);
def TargetPrice01 = (avg) - value;
def TargetPrice1 = (avg) + value;
def TargetPrice2 = (avg) + (value * 2);
def TargetPrice3 = (avg) + (value * 3);

def Entry = if isNaN(avg) then Entry[1] else avg;
def LastEntryBar = if Entry != Entry[1] then barNumber() else LastEntryBar[1];
def BuyBarsAgo = if barNumber() != LastEntryBar
                 then barNumber() - LastEntryBar
                 else if barNumber() == LastEntryBar
                      then Double.NaN
                 else BuyBarsAgo[1];


AddLabel(AreYouIn,
         "Cost: " +round(avg,2) +
         (if GetOpenPL() > 0
         then " | "+ "P/L: $" + GetOpenPL() +
              " | "+ aspercent(getopenPL() / (avg *  getquantity()))
         else " | "+ "P/L: -$" + GetOpenPL() +
              " | "+ aspercent(getopenPL() / (avg *  getquantity())))
         +    " | "+ " Bought: " +BuyBarsAgo +" days ago",
                 if GetOpenPL() > 0
         then Color.DARK_GREEN
         else Color.DARK_RED);

plot downside2 = if avg != 0  then TargetPrice02 else double.nan;
downside2.setstyle(curve.FIRM);
downside2.setdefaultColor(color.DARK_RED);

plot downside1 = if avg != 0  then TargetPrice01 else double.nan;
downside1.setstyle(curve.SHORT_DASH);
downside1.setdefaultColor(color.red);

plot avgprice = if avg != 0  then avg else double.nan;
avgprice.setstyle(curve.SHORT_DASH);
avgprice.setdefaultColor(color.Yellow);

plot upside1 = if avg != 0  then TargetPrice1 else double.nan;
upside1.setstyle(curve.SHORT_DASH);
upside1.setdefaultColor(color.light_GREEN);

plot upside2 = if avg != 0  then TargetPrice2 else double.nan;
upside2.setstyle(curve.SHORT_DASH);
upside2.setdefaultColor(color.light_GREEN);

plot upside3 = if avg != 0  then TargetPrice3 else double.nan;
upside3.setstyle(curve.FIRM);
upside3.setdefaultColor(color.dark_GREEN);

Can a total entry cost be added to it to see the full cost of all the shares I got in for?
 
Last edited by a moderator:
can a total entry cost be added to it to see the full cost of all the shares I got in for?
Cost is a bit more complicated, as has been discussed in this thread at length.
With those caveats, you can add the code from the 1st post of this thread to get you started:
https://usethinkscript.com/threads/...labels-of-owned-equities-in-thinkorswim.7089/

your request for a revision to "minutes" has been moved:
https://usethinkscript.com/threads/changes-days-to-minutes-in-p-l-label.19791/
 
How can I turn this into entry areas in the settings so I can change the %s to what ever I want at any time in the settings pop up?.
I think many others would like this as well to make it more easy to use.

So I can change each of the % areas in the setting area that it dose not have right now for each of the %s.
5% Stop, 5% Target, 10% Target, 15% Target

Here is the code that was posted into this group here .
https://usethinkscript.com/threads/...owned-equities-in-thinkorswim.7089/post-67202

See screen grab at bottom it shows the settings area dose not have the % areas to set in it. I would like them to be added in so they can be changed as needed easy.

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

input use_line_limits = yes;#Yes, plots line from/to; No, plot line across entire chart
input linefrom = 100;#Hint linefrom: limits how far line plots in candle area
input lineto = 12;#Hint lineto: limits how far into expansion the line will plot

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," P/L: " + AsDollars(PL) +" ",
if PL == 0 then color.cyan
else if PL > 0 then color.green
else color.red);

plot "5% Stop" = if Entry_ then Entry_ - .05*Entry else double.nan;
"5% Stop".SetDefaultColor(color.red);

plot "5% Target" = if Entry_ then Entry_ + .05*Entry else double.nan;
"5% Target".SetDefaultColor(color.green);

plot "10% Target" = if Entry_ then Entry_ + .10*Entry else double.nan;
"10% Target".SetDefaultColor(color.Yellow);

plot "15% Target" = if Entry_ then Entry_ + .15*Entry else double.nan;
"15% Target".SetDefaultColor(color.Magenta);

plot "20% Target" = if Entry_ then Entry_ + .20*Entry else double.nan;
"20% Target".SetDefaultColor(color.red);
# end code
Screenshot 2024-10-07 at 10.19.22 PM.png
 
Last edited by a moderator:
How can I turn this into entry areas in the settings so I can change the %s to what ever I want at any time in the settings pop up?.
I think many others would like this as well to make it more easy to use.

So I can change each of the % areas in the setting area that it dose not have right now for each of the %s.
5% Stop, 5% Target, 10% Target, 15% Target

Here is the code that was posted into this group here .
https://usethinkscript.com/threads/...owned-equities-in-thinkorswim.7089/post-67202

See screen grab at bottom it shows the settings area dose not have the % areas to set in it. I would like them to be added in so they can be changed as needed easy.
OYK3b6s.png

The script below has been modified so the stop and target percentages can be changed in the input settings:
Ruby:
# 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

input use_line_limits = yes;#Yes, plots line from/to; No, plot line across entire chart
input linefrom = 100;#Hint linefrom: limits how far line plots in candle area
input lineto = 12;#Hint lineto: limits how far into expansion the line will plot

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," P/L: " + AsDollars(PL) +" ",
if PL == 0 then color.cyan
else if PL > 0 then color.green
else color.red);

input stop1 = .05;
input target1 = .05;
input target2 = .10;
input target3 = .15;
input target4 = .20;

plot pstop1 = if Entry_ then Entry_ - stop1*Entry else double.nan;
pstop1.SetDefaultColor(color.red);

plot ptarget1 = if Entry_ then Entry_ + target1*Entry else double.nan;
ptarget1.SetDefaultColor(color.green);

plot ptarget2 = if Entry_ then Entry_ + target2*Entry else double.nan;
ptarget2.SetDefaultColor(color.Yellow);

plot ptarget3 = if Entry_ then Entry_ + target3*Entry else double.nan;
ptarget3.SetDefaultColor(color.Magenta);

plot ptarget4 = if Entry_ then Entry_ + target4*Entry else double.nan;
ptarget4.SetDefaultColor(color.red);
# 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
397 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