Chart label to display the P/L of a symbol

3AMBH

Member
2019 Donor
Found a simple code that displays a label in the upper left corner of a chart that shows the P/L of the stock symbol from date of purchase.

Create a study and call it what ever you like and add this code:

AddLabel(yes, GetOpenPL(), Color.WHITE);

I have it on my 1yr 1 day chart.
 

rad14733

Well-known member
VIP
@3AMBH I use the same basic label on my Option Trading panel as a compliment to the P/L Open column in my Active Trader ladder... Mine displays Green for increase and Red for Decrease in price movement, and Gray otherwise...

Ruby:
def PLOpen =  GetOpenPL();

AddLabel (yes, "P/L: " + AsText(PLOpen, NumberFormat.DOLLAR), if PLOpen > 0 then Color.GREEN else if PLOpen < 0 then Color.RED else Color.LIGHT_GRAY);
 

Similar threads

Top