Show trades on ThinkorSwim chart screen?

wcsharron

New member
VIP
Does anyone know how to add a line that shows purchases / Shorts on the screen, similar to how they show on the mobile screen? So it would show a line that extends right at the purchase prices.

Any help is greatly appreciated. By the time i draw a manual line i am sometimes out of the trade.
 
Solution
@Jony Giant @MerryDay . . . maybe this? I believe I read once that portfolio functions are limited to one year of data (please don't quote me on that) so not certain how far back in time this code will show. It appears to work for recent trades.

Code:
def x = GetQuantity();

plot start = x[1] == 0 and x <> 0;
     start.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
     start.setdefaultcolor(color.cyan);
    
plot end = x[1] <> 0 and x == 0;
     end.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
     end.setdefaultcolor(color.magenta);

Jony Giant

New member
@Jony Giant If you want to show the adds/profit-takings to your position (for long positions only) add this to the code -

Code:
plot add = x > 0 and x > x[1];
     add.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
     add.setdefaultcolor(color.white);

plot subtract = x > 0 and x < x[1];
     subtract.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
     subtract.setdefaultcolor(color.gray);
THANK YOU! You are a LEGEND! exactly what I was looking for. 🙏
 

Getyourbone

New member
Maybe I’m clueless but I have pasted numerous posts of the ”average actual entery” in this thread and still can’t get my trade price to display...I just seem to get a blue line that follows the trading price of the the particular ticker...I have bought and sold each time to make sure it had a fresh trade to apply it to. Do I need to do more than simply create a new study and paste the script in and the use it...?🤷🏻‍♂️
 

Pensar

Well-known member
VIP

Pensar

Well-known member
VIP
@Getyourbone I forgot to mention - the blue line you see that is following the price - it comes from the default plot Data = close; segment of code in each new study that is created. Just delete that line of code before pasting in the code you actually want.
 

sghk

New member
@Jony Giant If you want to show the adds/profit-takings to your position (for long positions only) add this to the code -

Code:
plot add = x > 0 and x > x[1];
     add.setpaintingstrategy(paintingstrategy.boolean_arrow_up);
     add.setdefaultcolor(color.white);

plot subtract = x > 0 and x < x[1];
     subtract.setpaintingstrategy(paintingstrategy.boolean_arrow_down);
     subtract.setdefaultcolor(color.gray);
Thanks for your code, it helps a lot! Also I'm wondering if there is a way to make the arrow placed right at the price level we traded in and out? Right now they are placed either on the top of the candle or below, hard to tell the accurate price especially on a long candle.
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Thanks for your code, it helps a lot! Also I'm wondering if there is a way to make the arrow placed right at the price level we traded in and out? Right now they are placed either on the top of the candle or below, hard to tell the accurate price especially on a long candle.
That is not possible. ToS doesn't provide us any portfolio information other than a P/L YTD.

@Pensar came up with this brilliant yet so simple concept. That we can use the fact that ToS does not keep any portfolio information to our favor.

What this script does, it is looks for when you were in a trade and the moment that ToS drops all that information. This script defines the "state" of your trade. In or Out. This is so cool!
 

ivctrader

New member
Just wanting to share #TodayTrades watchlist/chart label. This is number of trades, can be used as liquidity indicator together with volume.
Have to check the box "including extended trading hours" in script editor.

Code:
def Trades = Fundamental(FundamentalType.TICK_COUNT);
def newDay1 = GetDay() <> GetDay()[1];
rec todaystrades = if newDay1 then trades else todaystrades[1] + trades;
AddLabel(yes,(todaystrades), (if todaystrades > 100 then Color.whITE else Color.BLACK));
plot data=todaystrades;

If someone find some mistakes please let it know.
 

Similar threads

Top