I have a strategy pine script. I'd like to be able to better identify loosing trades on my plot, so I'm trying to make a bar plot like this:
Ideally, this only displays the bar when the trade is finalized (so I'm only interested in the final profit % of each trade (not its volatility). Even better would be if I can plot it at the time when the trade opens (not closes), so I can try to identify which trades not to open.
One option I see is to keep track of the profit and somehow create a series (not too sure about the syntax). Or, very possibly, this information is saved in strategy right?
Update: after trying the code from Andrey-D it shows up like this (even without overlay = true):

