Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 20:31:46 +0000



[Locked] - LIFO /FIFO fill matching problem in REPLAY

View Count: 4760

[2018-10-13 02:51:14]
Sierra Chart Engineering - Posts: 104368
So far we are not seeing a problem. Here is some example output during a trade with scaling in and out:

LIFO: B1/25366, avg=25366 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, avg=25326 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B1/25295, avg=25315.666666666668 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, avg=25326 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B1/25298, avg=25316.666666666668 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B0/25298, S0/25228, avg=25326 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B0/25298, S0/25228, B1/25230, avg=25294 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B0/25298, S0/25228, B0/25230, S0/25222, avg=25326 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B0/25298, S0/25228, B0/25230, S0/25222, B1/25282, avg=25311.333333333332 | 2018-10-12 22:47:49
LIFO: B1/25366, B1/25286, B0/25295, S0/25295, B0/25298, S0/25228, B0/25230, S0/25222, B0/25282, S0/25258, avg=25326 | 2018-10-12 22:47:49
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: 2018-10-13 02:51:25
[2018-10-13 03:01:31]
Sierra Chart Engineering - Posts: 104368
At this point we would need to get your TradeActivityLog.data file and be told the particular symbol you are trading and the time range of the overall trade and the time zone. We then have to look at the data. Or we can keep the logging enabled and you can look at what we see.
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
[2018-10-13 03:14:26]
Sierra Chart Engineering - Posts: 104368
Here is another example:

LIFO: B1~1/26431, Avg=26431 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, Avg=26437 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, B3~3/26461, Avg=26449 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, B2~3/26461, S0~-1/26471, Avg=26446.6 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, B1~3/26461, S0~-1/26471, S0~-1/26456, Avg=26443 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, B1~3/26461, S0~-1/26471, S0~-1/26456, B4~4/26460, Avg=26451.5 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B2~2/26440, B1~3/26461, S0~-1/26471, S0~-1/26456, B2~4/26460, S0~-2/26461, Avg=26448.666666666668 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, Avg=26435.5 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B3~3/26431, Avg=26432.8 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B3~3/26431, B3~3/26445, Avg=26437.375 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B3~3/26431, B1~3/26445, S0~-2/26459, Avg=26434.833333333332 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B2~3/26431, B0~3/26445, S0~-2/26459, S0~-2/26428, Avg=26433.25 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B0~3/26431, B0~3/26445, S0~-2/26459, S0~-2/26428, S0~-2/26471, Avg=26435.5 | 2018-10-12 23:12:03
LIFO: B1~1/26431, B1~2/26440, B0~3/26461, S0~-1/26471, S0~-1/26456, B0~4/26460, S0~-2/26461, S0~-4/26344, B0~3/26431, B0~3/26445, S0~-2/26459, S0~-2/26428, S0~-2/26471, B1~1/26480, Avg=26450.333333333332 | 2018-10-12 23:12:03

This shows scaling and scaling out during a long overall position and to the left of the ~character is the quantity after scaling out and the right of it is the original quantity. It looks correct to us.
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
[2018-10-13 16:11:04]
User884307 - Posts: 173
Hi,

Okay can I take a big step back because I fear the situation is going to go into an alternate scientific viewpoint if not an alternate reality :-//

Let me just explain what LIFO is meant to do and of which Sierra Charts does very well indeed (upto version 1810). I have a fear that you have gone way too scientific on the whole thing and made something really simple become a monster with lots of numbers trying to justify something that doesnt have to be...... (AS ABOVE!!)

Example of LIFO (and as long as your science of going from A to B derive at the same conclusion then Brilliant, we have LIFO working again!)

Assuming Daily and running P/L are zero at start and trading ES front month (not that that really matters), also not relevant how order is filled (i.e. market or limit)

I (A)BUY 10 @ 2773.00 ..... the market moves down to 2772.00

at this point the position is showing running P/L -500

I then (B)BUY 10 @ 2772.00

..... the market moves up a tick to 2772.25 of which I SELL 10 @ this price (B) ... This (B) to (B) LIFO is complete and proved profitable

........ MY DAILY P/L now shows +125 (AS IT IS MEANT TO DO USING LIFO ORDER MATCHING)!!!!!!!!

MY RUNNING P/L is now showing a running loss (of -375 at 2772.25) on the original 10 bought back at 2773.00 (A)

Lets assume the market now moves up to 2773.50, my running P/L now will be showing +250 and my Daily P/L will already have +125 from the last completed LIFO trade (B)(B)

I decide to (A) SELL 10 @ 2773.50 which gives me a profit of +250 on the ORIGINAL trade at 2773.00 we started off with (A). This (A) to (A) LIFO is now complete and also proved profitable

I am now FLAT with a total profit on the two trades of +375

The sequence of this LIFO therefore is (A)BUY ------> {(B)BUY ------> (B)SELL .. profit} ------> (A)SELL {profit} ------> FLAT

Simply look at version 1810 using LIFO and if you can duplicate that using your "NEW" way of doing things and end up with the correct numbers then happy days I reckon!!!

Cheers
[2018-10-13 21:22:12]
Sierra Chart Engineering - Posts: 104368
I have a fear that you have gone way too scientific on the whole thing and made something really simple become a monster with lots of numbers trying to justify something that doesnt have to be...... (AS ABOVE!!)
In reality, it is the exact opposite. There has been a major simplification of the internal code and the method of determining the Position Average Price, is very reliable now and can be done in so many more cases than previously. We are quite happy with the outcome so far. We just need to finish with some additional fields for Trade statistics for flat to flat calculations.

Basically what you also want is the Daily Profit/Loss to use a last in first out calculation. That is just an additional calculation. We will do 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
[2018-10-15 21:11:13]
Sierra Chart Engineering - Posts: 104368
For a Last In First Out Daily Profit/Loss calculation use pre-release 1822. We only did a very quick test just to validate that the daily PL is calculating but did not validate that the result is correct but we would expect it to be. We did not have a chance to get to further testing yet.

You need to look for the Daly PL on the Trade Window and at the top left of the chart. The Daily PL you you see in the spreadsheet when using the Spreadsheets System for Trading study does not yet use this calculation.
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: 2018-10-16 01:35:07
[2018-10-15 21:18:29]
User884307 - Posts: 173
HI

Do you mean FIFO or (hopefully you mean) LIFO ?

Cheers
[2018-10-16 01:35:34]
Sierra Chart Engineering - Posts: 104368
We meant LIFO. And corrected the post above.
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
[2018-10-16 03:46:37]
phaedonk - Posts: 350
I appreciate that you made the setting per chart, this is helpful. However, as before through global trade settings, it is 4 mouse clicks to enable.

Is it possible that we can have it as a shortcut to add to the toolbar? Thank you.
[2018-10-17 10:02:01]
User884307 - Posts: 173
Hi, just managed to have a look at v1822, all seems to be working well from what Ive just seen.

The order IDs for each position that are sent to exchange are going to comply with LIFO (if this option is set in SC) I assume? (I hope so LOL!!!!)

Cheers
[2018-10-17 10:19:12]
Sierra Chart Engineering - Posts: 104368

The order IDs for each position that are sent to exchange are going to comply with LIFO (if this option is set in SC) I assume? (I hope so LOL!!!!)
We do not see the relationship between LIFO and the sending of orders. How your trading service is going to match orders for backend accounting we do not know. But we do not see the relevancy of that either.
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: 2018-10-17 10:19:30
[2018-10-17 10:39:20]
User884307 - Posts: 173
Because your your daily/running p/l in SC at any point has to reflect real p/l otherwise it's pointless!
[2018-10-17 10:49:54]
Sierra Chart Engineering - Posts: 104368
Okay unrelated to this, there still could be an implementation problem with the LIFO Daily Profit/Loss. It should work properly in real time trading when starting with a new position, but it does not look as though the calculation can be done properly upon a reload of the chart while in a position or if the position is flat. We will fix that but it will have a dependency on the Trades List having a correct Position Quantity which can be done. We will follow-up with more details later today.
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: 2018-10-17 10:50:59
[2018-10-17 11:12:10]
User884307 - Posts: 173
Okay, will the the ID's for each contract be sent to (in my case CQG using SC) in the same sequence of the LIFO method (or FIFO if selected) in SC to exchange?

This was the whole worry and issue I had from the start, its lovely having this fully working again(hopefully) LIFO in SIM but the orders ABSOLUTELY HAVE TO BE MATCHED on server side in LIFO method / or FIFO method etc. otherwise there is absolutely no reality in this whole exercise?

Cheers
[2018-10-17 17:29:06]
Sierra Chart Engineering - Posts: 104368
Okay, will the the ID's for each contract be sent to (in my case CQG using SC) in the same sequence of the LIFO method (or FIFO if selected) in SC to exchange?
None of this makes any sense from our side. There is no association between the two, and we will not comment on this further . This is not within the scope of our support and you have a misunderstanding here.
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
[2018-10-17 18:47:52]
Sierra Chart Engineering - Posts: 104368
We have given some thought to using Last In First Out to the Daily Profit/Loss calculation.

To do this properly requires that the position quantity is determined by what is called the Trades list. In the past the LIFO Position Average price was being calculated by the trades list and was using the position quantity as determined by the trades list. This was not always reliable and therefore the correct average price could not always be determined.

The new method of determining the LIFO position average price is much more reliable. But this reliability means that it is not possible to do the LIFO Daily Profit/Loss when loading of historical fills which is absolutely critical. So in version 1823 we have removed that calculation and reverted Daily Profit/Loss back to using FIFO.

So at this point our decision is we are not going to support LIFO with Daily Profit/Loss because it cannot be done accurately and also still support a reliable LIFO calculation for Position Average Price. We will still think about this but it would require additional options but right now we do not want to get involved in that and confuse users.
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: 2018-10-17 18:48:22
[2018-10-17 19:17:13]
User884307 - Posts: 173
Hi

I dont think that I am misunderstanding anything, however if I am then if you would clarify my points below then I think I definately will be understanding correctly.

1) In my post #28, I explain a simple LIFO trading scenario demonstrating what should be displayed (as a result of two simple trades using LIFO) in the Daily & Running P/L.
My question is, Does my LIVE trading account mirror SC's daily / running P/L at every point (using my example in #28) where SC is submitting to the Exchange the correct orders to close out
with reference to that particular last opening trade I.E LIFO or is SC just sending random close orders with no reference to anything else other than itself?

2) You mention in your post #6 and #29 about "cleaning up" a previous developers code for this particular issue and also saying you have implemented a "major simplification of the code", could it
be fair to assume with everything you have told me up until this point, that there may have been a REALLY REALLY good reason that the original code was NOT "Simplified" or simple in the first
place?

I am sooooo really really trying to work with you guys, VERSION 1810 worked as it should do in every way, I stand to be corrected by fact but it seems to be my understanding that you have TOTALLY brain damaged one of the most important CORE implementations of Sierra Chart.

Furthermore, having a Daily & Running P/L that has no bearing or reference to reality is a complete waste of time and only useful in a "non real world" environment or a "game" scenario.

PLEASE PLEASE tell me Ive got it all wrong and that Sierra Chart does indeed send orders to the Exchange WHICH REFERENCE the order matching system currently using i.e. FIFO, LIFO etc etc

I look forward to your comments

Best regards
Date Time Of Last Edit: 2018-10-17 19:17:57
[2018-10-18 09:59:14]
User884307 - Posts: 173
I am disappointed you havent acknowledge my last post.

I urge you to reconsider this implementation.

Do you realise that this is a basic feature (LIVE TRADING + SIM) on just about all free/entry level DOM's and Charting+DOM software, this is nothing amazing or obscure, its NORMAL!

By removing this feature you render Sierra useless for anyone wanting to scalp/build multiple positions for quick turnaround and it then enters the realms for novice demo account holders and a low end order entry functionality platform.

Its such a shame and blatently obvious that you have little if any trading experience otherwise you would recognise the importance of this thread!

Being alright at coding is great but you have to pay 100% attention to what you are coding and what pays the bills at the end of the day.

I suggest that you use the V1810 code, stop being arrogant in the face of complete naivety and lets work together.

I will roll back to v1810 and in meantime would appreciate it if my suggestions could be considered.

I have been a loyal subscriber to Sierra for over 4 years and I feel saddened to the way it is now going.

I would appreciate your reply otherwise only option for me is MarketDelta where traders USE coders to implement their ideas!!! (you can do this too?????)

I look forward to your comments

cheers
[2018-10-18 18:33:21]
phaedonk - Posts: 350
There appears to be an oversight in the implementation, as I just tested it only now.

Please see the pic. I had selected LIFO in chart settings.
http://www.sierrachart.com/image.php?Image=153988694253.png

It's two entries (pink circles) followed by one exit (red circle). It appears that the exit has correctly closed the last entry, as evidenced by the position line moving back to the first entry.

However, the entry/exit connecting line incorrectly matches the exit with the first entry.

Also, an answer to #33 please?
[2018-10-18 19:57:02]
Sierra Chart Engineering - Posts: 104368
In regards to post #43, the order matching you see for the order fills on the chart will always use FIFO. That cannot be changed. The LIFO is only for the position average price calculation.

We need time to look at post 41 and 42.
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: 2018-10-18 19:57:17
[2018-10-19 00:02:27]
phaedonk - Posts: 350
Why can it not be changed? It used to be like that! I might as well downgrade too, this does not make any sense!
[2018-10-19 08:32:50]
Sierra Chart Engineering - Posts: 104368
In regards to post 42 and 43, we are very very busy and you cannot expect quick answers to us.

Previously we said this:
So at this point our decision is we are not going to support LIFO with Daily Profit/Loss because it cannot be done accurately and also still support a reliable LIFO calculation for Position Average Price. We will still think about this but it would require additional options but right now we do not want to get involved in that and confuse users.
We have thought about this and we are now implementing a solution. It is a new Position Average Price option named:
"Use Last In First Out Fill Matching for Open Position Average Price and For Daily Profit/Loss (less reliable)"

or is SC just sending random close orders with no reference to anything else other than itself?
Yes.
When Sierra Chart sends orders there is no connection between how Sierra Chart matches orders for reporting and how the backend trading service which in your case would be CQG is matching orders. The two are wholly unrelated. And this is totally irrelevant as well. Unless there is an interest in a real-time account balance calculation which CQG does not provide any way.

----

Why can it not be changed? It used to be like that!
We have been consistently clear and we have stated this here:
Reimplementation of Trades and Trade Statistics and Period Trade Stats Tabs/Calculations | Post: 158120

We have only said that LIFO would be used for the Position Average price in this thread. And added the capability to also do the Daily Profit/Loss.
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: 2018-10-19 08:33:35
[2018-10-19 10:22:04]
Sierra Chart Engineering - Posts: 104368
In regards to post #46, the work is now complete and we will have 1824 out in about 20 minutes.
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: 2018-10-19 10:22:46
[2018-10-19 20:13:38]
Sierra Chart Engineering - Posts: 104368
1824 has a bug related to this development which could lead to instability. We just discovered this now. It has been fixed and we are releasing a new revision of 1824. If you are using 1824, update as soon as possible again using Help >> Download Prerelease.
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
[2018-10-27 13:43:49]
User884307 - Posts: 173
Hi, thought id send this.

It demonstrates the option of LIFO ------> WHICH IS USED FOR CORRECT ORDER ROUTING AS PER LIFO, this is NOT just an "average" type price display, IT IS ESSENTIAL FOR TRADING ORDERS CORRECTLY !!!!

http://help.cqg.com/marketdelta/#!Documents/configuringaccountsettings.htm


This is NOT just a request, it is essential that it is incorporated, could you advise me that steps to this end will be made as then I can make appropriate choices, I'm still hanging in there ..... just !!
Date Time Of Last Edit: 2018-10-27 13:45:48
[2018-10-27 15:01:49]
phaedonk - Posts: 350
Regarding "Last in first out order fill matching is being removed.": It is disappointing that you have decided this. Easier code maintenance is not the goal here, I am assuming. Otherwise, development would have ended at "Hello world".

Removing a feature that customers want and use simply does not make sense. Building a new feature with all that you have on your plate and deciding against it, even if people want it, is understandable. But removing an existing feature? No sense, even if it makes your life easier. I urge you to reconsider.

Regarding the release 1821: After installing it, a new (single) position on a live account is not showing on the chart (FIFO on chart settings 3). The only way to view it is to open chart settings and just click on Apply, nothing else. Then the position line magically appears. If I select "use external service" in chart settings 3, the position shows immediately when it fills.

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

Login

Login Page - Create Account