Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 07:26:43 +0000



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

View Count: 2595

[2019-01-23 23:11:47]
User972768 - Posts: 166
Hello,

Thanks for building this great charting/trading environment. I really enjoy using it.

Could you please help with correct settings to get average price of my trading position? I checked all available options in the Chart >> Advanced Settings 3 >> Open Position Average Price, but can’t find method that I prefer. Here is quick example of trading up to 2-lot position in and out few times to improve average price of the position ('+' - opening long entry, '-' - closing long entry:


Fill Price Position size Current Average
+51.0 1 51.00
+50.0 2 50.50
-51.0 1 50.00
+50.5 2 50.25
-52.0 1 48.50
-54.0 0 0.0 (Profit +5.50)

Formula is very simple: SUM of all fills divided by current number of lots
Example above was for long position. For short position, all fills are entered the same way (negative numbers for opening short position and positive numbers for closing them.

My goal is to see average price of my position in the Trade Window / Trade DOM in the "Pos Qty@Price" field. Trading Information Windows: How Average Price for Positions Is Calculated and Used

It would be very helpful if similar examples would be present on web page describing different ways of average price calculation.

Thanks and best regards.
Date Time Of Last Edit: 2019-01-23 23:34:59
[2019-01-24 16:32:21]
User972768 - Posts: 166
Just one more quick note

On the surface this looks very similar to "Last In First Out", but the issue is that that method doesn't do any calculations of the average during the trade. The need for the Current value of the average for me is to set stops according to it, not to the initial entry point. Some people use this method to get better understanding of their position during Scaling In.

Thanks
[2019-01-24 19:31:05]
Sierra Chart Engineering - Posts: 104368
This particular calculation method is not supported. It can be added. We will see about that.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-01-24 20:13:15]
User972768 - Posts: 166
Thank you very much for quick response. Look forward to see it in the interface.
[2019-02-06 21:49:47]
User972768 - Posts: 166
Hello,

v1870 brought new type of calculation of average price: "Use Flat to Flat Open Position Average Price - Average All". Just wanted to confirm that it is what we discussed in this thread since there is no documentation on it yet.

Thanks again for very quick response
[2019-02-06 22:15:19]
Sierra Chart Engineering - Posts: 104368
Yes it is not documented but should do what you want.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-02-07 10:22:59]
User41397 - Posts: 3
Hello, I tested it on replay and it seems to calculate wrong the flat to flat average:
On Replay I entered two contracts short at 7030 covered one contract 7020 at this point it was showing average at 7026.67 for the remaining one open contract (really strange reading) I was expecting to see that the breake even for the flat to flat position would move to 7040 after the first contract was closed with 10PT profit.
image2019-02-06 screenshot average flat to flat.jpg / V - Attached On 2019-02-07 10:21:06 UTC - Size: 258.1 KB - 551 views
Attachment Deleted.
[2019-02-07 16:04:46]
Sierra Chart Engineering - Posts: 104368
That is the correct calculation. It is the sum of the fill prices times the quantities divided by the total quantity.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[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
[2019-02-12 03:09:29]
Sierra Chart Engineering - Posts: 104368
Okay we are implementing this now.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-02-20 17:28:41]
User972768 - Posts: 166
Thank you again. Glad to confirm that under v1875 new calculation works as expected. I was able to see correct value during multi-lot long trade in Trading DOM field. So far I didn't have a chance to place multi-lot short trade. So confirming only long multi-lot trade results at the moment.

Another observation is that study "Trading: Position Average Price" does not produce expected results. The line is close to what I would expect, but not exact.

Details of this "not-the-best" trade and values of the study:

Fill Lots Theoretical average Study value
+84.00 1 84.00 84.00
+83.50 2 83.75 83.75
-83.75 1 83.75 83.50
+83.25 2 83.50 ~83.37
-83.50 1 83.50 83.25
-85.50 0 0.00 0.00

I also attaching screenshot showing fills and "Position Average Price" study in dashed pink color.

Thank you and best regards.
Date Time Of Last Edit: 2019-02-20 17:31:41
imageAverage_position_price.png / V - Attached On 2019-02-20 17:25:06 UTC - Size: 49.14 KB - 397 views
[2019-02-21 00:43:38]
Sierra Chart Engineering - Posts: 104368
"Trading: Position Average Price" is based on the standard calculation in the Trades list will always be using first in first out.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2019-02-21 00:44:19
[2019-02-21 04:51:46]
User972768 - Posts: 166
Thank you for quick response. Would be there any chance to implement some sort of connection between the "Trading: Position Average Price" study and related setting of the chart it is used on? Without such connection Trading DOM shows one number while study shows another one.

How about other option to open source of this study? If this would be possible, then I can just code my own study based on official code.

Thanks again and Best regards
[2019-02-26 04:02:55]
whats1thingnow - Posts: 407
hello,

i only see "Use Flat to Flat Open Position Average Price"

is there supposed to be an option for "Use Flat to Flat Open Position Average Price - Average All"?

i'm on 1875
[2019-02-26 05:08:14]
Sierra Chart Engineering - Posts: 104368
How about other option to open source of this study? If this would be possible, then I can just code my own study based on official code.
It is not that simple. There is not just one simple study but many components involved in this. The code is very deep and complex.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-02-26 05:08:49]
Sierra Chart Engineering - Posts: 104368
Use the latest prerelease, look for the Theoretical Average price option.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2019-02-26 05:08:58
[2019-03-04 21:41:24]
User972768 - Posts: 166
Re: #15.

Wouldn't you agree that it would make perfect sense to expect the "Trading: Position Average Price" study to reflect chart settings... So, if I change the way to calculate average price of my position as a setting of the chart, if I see this logic reflected in the DOM's value, so study should present same numbers on the chart either...

Thanks and best regards
[2019-03-05 01:58:16]
Sierra Chart Engineering - Posts: 104368
There is no chance we can be supporting this anytime soon. It is just not going to come. The question is pointless. We don't have time for this. It is very involved.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account