I'm trying to track the low price since entry for my short positions as I have done with the high price for long positions. For some reason the reverse code does not work with shorts. The long/high plots fine. with different variations to my code I get a flat '0' plot or I get a low that retraces up from the low point. I basically want to set a trail retracement level where I could stop out of deals that don't quite reach TP% before retracing.
This is the basic code to generate the plot. Long works fine however this short version and other variations have not worked. They either retrace with the price increasing rather than showing the lowest point or they plot '0'. The plot for long and short_entry price works fine, so the other code is initialising the start point correctly.
var float high_price_since_entry = na
high_price_since_entry := math.max(long_entry_price, nz(high_price_since_entry[1]), high)
var float low_price_since_entry = na
low_price_since_entry := math.min(short_entry_price, nz(low_price_since_entry[1]), low)