Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 00:37:15 +0000



Post From: Can't find expected way to calculate average price for position

[2019-02-07 16:30:32]
User972768 - Posts: 166
The method is slightly different. It is not just sum of all fills divided by total quantity. It should be divided by CURRENT quantity.

Here is another example of expected way to calculate in "long" trade ('+' is opening "long" lot, '-' is closing lot):

Fill Current position Current AVG Sierra AVG Formula
in lots
+9.75 1 9.75 +9.75 / 1
+8.75 2 9.25 (+9.75 +8.75) / 2
-9.25 1 9.25 (+9.75 +8.75 -9.25) / 1
+7.50 2 8.38 (+9.75 +8.75 -9.25 +7.50) / 2
-8.00 1 8.75 8.65 (+9.75 +8.75 -9.25 +7.50 -8.0) / 1
+8.25 2 8.50 8.58 (+9.75 +8.75 -9.25 +7.50 -8.0 +8.25) / 2
-8.75 1 8.25 8.61 (+9.75 +8.75 -9.25 +7.50 -8.0 +8.25 -8.75) / 1
-10.00 0 +1.75 profit Exception: (+9.75 +8.75 -9.25 +7.50 -8.0 +8.25 -8.75 -10.0)

Above example is from my live ES trade today that I had to scratch under v1870 with new method to calculate average value. Sorry, I didn't capture all values that were produced by software during the trade. Method that we discuss in this ticket should produce values in the "Current AVG" column. It is also known as Theoretical Average and is widely used by people like FuturesTrader71. It is part of Bookmap software as well and has multiple implementations in NinjaTrader.

Calculation is simple: sum up all fills (to open a lot and close it) until current point and divide it by value in the "Current lots" column. For long position use positive value to open lot and negative to close it. For short position use negative value to open lot and positive to close it.

Hope that helps.

Thanks again
Date Time Of Last Edit: 2019-02-07 21:41:35