I don't understand how the variable works.
In the example above, the result of the strategy.
The yellow line indicates the value of strategy.position_avg_price. We have opened 2 trades (L2 and L3), after that the average value is considered correct, as the arithmetic mean between trade entries.
After the take profits are closed (they are multiple, there can be up to 5 in total), the value of the strategy.position_avg_price changes.
Why? And if there is an explanation for this, then by what formula is it calculated?
I tried to calculate different averages myself, trying to fit under strategy.position_avg_price, but without success.