Login Page - Create Account

Support Board


Date/Time: Sun, 12 May 2024 14:05:51 +0000



Prior Position Quantity (J7) not updating

View Count: 985

[2020-07-15 07:20:34]
rabbitTrader - Posts: 16
Prior Position Quantity (cell J7 in Spreadsheet System for Trading) is still incorrect after updating from version 1997 to 2135. It gets stuck on a correct figure and then fails to update. This leads to many errors in a live system (on BitMEX) and forces a manual exit. This error hasn't ever been seen in testing.

In addition, the Display Fill Text position size (displayed as flag on chart) is off by what appears to be the same amount as J7.

The PositionQuantity field in Trade Activity Log is correct, however.

Please investigate and advise. Thanks.
Date Time Of Last Edit: 2020-07-15 08:41:48
[2020-07-16 02:18:28]
Sierra_Chart Engineering - Posts: 14319
There definitively is no problem with this cell when using the Spreadsheet System for Trading study:
Prior Position Quantity (read-only):

It works perfectly and correctly. We tested this. We recommend testing it in Trade Simulation Mode:
Trade Simulation


In regards to:
In addition, the Display Fill Text position size (displayed as flag on chart) is off by what appears to be the same amount as J7.

Refer to:
Chart Trading and the Chart DOM: Accurate Entry/Exit State, Fill Matching and Position Quantities
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-07-17 09:44:19]
rabbitTrader - Posts: 16
Here is the behavior I'm continually seeing with Prior Position Quantity (J7):

0) with Sierra Chart closed, TradeActivityLogs files are deleted

1) start Sierra Chart with zero position sizes everywhere -> connect to BitMEX (live) and start

2) buy 1 contract ==> but two separate fills of 1 show up on the chart on precisely the same tick (when this happens, each time it says "Unspecified" under OrderStatus in the Trade Activity Log for the first fill, while the second fill correctly has OrderStatus of "Filled")
===>Position Quantity (J5) = 1 [correct]
===>Prior Position Quantity (J7) = 1 [perhaps correct in terms of the calculation, but incorrect in terms of what transpired; it should be 0, of course]

3) buy 2 additional contracts ==> again, two separate fills of 2 show up on the same tick (OrderStatus again is "Unspecified" for the first and "Filled" for the second)
===>Position Quantity (J5) = 3 [correct]
===>Prior Position Quantity (J7) = 4 [it should be 1, but it's 1_correct + 1_error + 2_error instead]

It seems that these Unspecified "fills" are creating problems in the trade log.

If you tell me that this behavior is to be expected and I need to live with it, then so be it. I'll figure out how to work around it, but I currently heavily rely on Prior Position Quantity for a lot of equations. Thanks for any help you can provide. (FYI: This system was tested extensively in simulation, and this issue did not occur even once.)
Date Time Of Last Edit: 2020-07-17 10:14:21
[2020-07-18 10:49:30]
Sierra Chart Engineering - Posts: 104368
What is clear is that this is a BitMex specific issue. Apparently something has changed on the BitMex side, where there are two fills being sent per single fill. This does not make sense.

A problem like this does not exist with any other supported trading service.

We do not know when this problem began. It is not something we can spend any time on anytime soon. It is BitMex specific.

Otherwise there will not be a problem at all.
----
Your Sierra Chart account which you have logged into this Support Board with is expired. So we know what Sierra Chart account you are using, go to Help >> Support Board from within the Sierra Chart desktop program and then post in this thread telling us this is done.
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: 2020-07-18 10:49:56
[2020-07-19 01:57:35]
rabbitTrader - Posts: 16
After additional investigation, it seems that these errant fills are historical fills. For past fills (from hours to days prior) that are to be drawn on the chart, this is okay. But these historical fills sometimes show up for new trades (usually around 300ms before the correct fill message), which confuses Sierra Chart into seeing two fills instead of one. (See screenshot attached.) A simple solution would be the ability (via check box or similar) to disregard historical fills.

(My partner and I have an updated and fully paid version of Sierra Chart under a different account. I just happen to have this login memorized, which is why I often choose to use this one. If it's important to you, then I'm happy to use the other one going forward. I will send you a separate email at support@sierrachart.com to discuss another somewhat related issue that demands more discretion.)
Date Time Of Last Edit: 2020-07-19 07:24:34
imagehistorical fill vs order update.JPG / V - Attached On 2020-07-19 01:56:52 UTC - Size: 63.26 KB - 292 views
imagehistorical fill vs order update 2.jpg / V - Attached On 2020-07-19 06:00:02 UTC - Size: 408.03 KB - 317 views
[2020-07-28 02:42:21]
rabbitTrader - Posts: 16
I've gone back and forth with BitMEX on this, and they believe the issue must be related to this:

https://blog.bitmex.com/api_announcement/change-in-inter-table-ordering-of-messages-on-websocket/

I'm building a workaround now, as I understand that a fix for this is a lower priority at this time.


Text of above link:

Change in Inter-Table Ordering of Messages on WebSocket
BitMEX
6 Apr 2020

At 01:00 UTC on Tuesday, April 21, 2020, BitMEX will begin transitioning its internal feeds infrastructure to a new version that will offer significantly improved latency, especially at the 75th, 90th, and 95th percentile.

This is our fourth major version of the system, and all previous major upgrades have maintained compatibility from version to version, with no user-facing changes required.

BitMEX allows subscribing to multiple tables through a single WebSocket connection. While messages within a single table follow a predictable order as generated by the trading engine and API, BitMEX has never guaranteed the ordering of messages between tables. For instance, if you execute a trade against resting liquidity, it is not guaranteed which of trade, instrument, position, execution, or margin will be received first.

However, in the third major revision, which was rolled out progressively from August 1, 2019 to August 8, 2019 and is in use today, inter-table orderings were relatively predictable. This was not the case before this time. We are aware that some users may have come to rely upon a predictable order. We have never guaranteed this ordering nor instructed users to rely upon it, suggesting instead that programs should be built to be event-based and to use all available data as it is received.

When we begin our roll-out on April 21, it will no longer be possible to rely upon a specific inter-table ordering, as tables will now begin to be processed by independent workers that will emit as soon as their processing is complete. As a result, long-tail latency is greatly improved.

The BitMEX Testnet was already migrated over to the next-generation infrastructure on March 24th. If you would like to test your existing programs, please connect to Testnet.
[2020-07-29 20:36:19]
Sierra Chart Engineering - Posts: 104368
We will be looking this over in the next couple of days.
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
[2020-10-05 06:09:28]
Sierra Chart Engineering - Posts: 104368
We will not be investing any further time in BitMex development due to the CFTC charges against the principles of the company.
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