Hello, I want to create a calculation to know at where I close stock trades, in order to improve my performance.
(apart from everything else) I measure ORDER::max_unrealized_gains and ORDER::max_unrealized_losses per share.
In this example
ORDER::max_unrealized_gains = $0,39
ORDER::max_unrealized_losses = -$0,15
Total range = $0,54
Closed trade for = $0,12
Percentage in the range = 50% (as 0,15 from negative side and 0,12 from positive make 0,27 and that is 1/2 from 0,54 range).
If I closed trade at $0,39, percentage in the range would be 100% (as it is at the very top of the range)
If I closed trade at -$0,15, percentage in the range would be 0% (as it at the very bottom)
If I closed trade at $0,255, percentage in the range would be 75% and so on. (as it is close to the top)
So how can I make this "percentage in range" calculation?