Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 16:24:10 +0000



ACSIL Trade Fill List

View Count: 3213

[2014-04-25 01:01:37]
QnReally - Posts: 181
Hello,

I was wondering if there is a way to access the trade fills data from ACSIL like the one shown when I go to: Trade menu -> Trade Activity Log -> Trade Activity tab. I just want to get the records of Activity Type = Fill.

I can get the matched trades with sc.scGetTradeListEntry() but I am just looking for the individual fills.

Thanks.
[2014-04-25 01:18:57]
Sierra Chart Engineering - Posts: 104368
No, this is not supported.
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
[2014-04-25 02:29:57]
QnReally - Posts: 181
After I enter a trade, sometimes I might increase/decrease my position multiple times without getting flat. To me that means I am still in the same trade, until I get flat again. I would like to know where my loss price would be while I am in the trade. So if the market went beyond that loss price, my losses for the trade would accrue but before that price I would be in a profit for the trade. As soon as my position is flat I would consider that trade to be completed. My question is, is there a way to get that loss price either as a text or as a line on my chart?

Another minor question regarding what is available via sc.scGetTradeListEntry(): does SC basically read the fills and stitch together the trades by matching the buys and sells?

Assuming currently there is not a way to get the loss price on a flat-to-flat basis as I mentioned earlier, would you be willing to support access to {symbol, buy/sell, quantity, averageFillPrice, Date/Time} information via ACSIL? I am looking for this information for just the current day.

Thanks.
[2014-04-25 02:39:13]
QnReally - Posts: 181
By the way, if I set "Use Flat To Flat Average Price For Position Line", I believe it averages the entry price but only when I add to the position. When I decrease the position the average on the Position Line doesn't seem to change. It is possible I could be doing something wrong but that is what I observed with my current config.
[2014-04-25 02:58:30]
Sierra Chart Engineering - Posts: 104368
We assume you know about the current open position profit/loss:
https://www.sierrachart.com/index.php?l=doc/doc_ChartTrading.html#ViewingOpenDailyClosedPL


Another minor question regarding what is available via sc.scGetTradeListEntry(): does SC basically read the fills and stitch together the trades by matching the buys and sells?
Refer to:
https://www.sierrachart.com/index.php?l=doc/doc_TradeActivityLog.php#OrderFillMatchingMethods

would you be willing to support access to {symbol, buy/sell, quantity, averageFillPrice, Date/Time} information via ACSIL?
No.

By the way, if I set "Use Flat To Flat Average Price For Position Line", I believe it averages the entry price but only when I add to the position. When I decrease the position the average on the Position Line doesn't seem to change. It is possible I could be doing something wrong but that is what I observed with my current config.


Makes sense. This is how the flat flat average price calculation works.
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
[2014-04-25 21:13:10]
QnReally - Posts: 181
Alright. Now, coming from a different angle, trying to use the Orders that are filled using sc.GetOrderByIndex(). The header file scconstants.h shows the following:
, SCT_OSC_FILLED // Order has been completely filled or partially filled, and is no longer considered working.

If an order is partially filled what would show up in the "Orders" tab of "Orders And Positions" window? Say, I enter a buy order for 2 contracts. Then I expect to see one row there showing a status of unfilled (something other than Filled) for 2 contracts. If one of the two contracts gets filled and the other is still in the queue what should I expect to see there(1. still one row with Filled status or 2. the one row now split into two rows each showing different statuses)?

Thanks.
[2014-04-25 21:19:56]
Sierra Chart Engineering - Posts: 104368
The status will be Open for a partial filled order if it is still working. And the Filled Quantity column indicates the amount filled.
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
[2014-04-26 03:31:58]
QnReally - Posts: 181
Here is what I have looked into so far.
Method 1: Using the trades from sc.scGetTradeListEntry()
The fills seem to be matched and trades seem to be split when appropriate. I can work with that probably. I tried various sequences of fills to test out how the data available via sc.scGetTradeListEntry() would show up. I ran into one minor issue. I entered the following fills in a succession: -1, -2, and -1. So that is a total of short 4 contracts. As I expected, I saw three rows in the Trade Activity Log. Then I executed +2. The first -1 entry got matched with +1 (one of the 2 long contracts) and that showed up as a completed trade. The -2 entry got matched with the remaining +1. I expected that trade to be split here into two -1's because in my other trials with different sequences of shorts and longs with various sizes, the trades seem to be getting split. I am using FIFO method in the General Trade Settings window for matching the fills. See this image: http://screencast.com/t/eZASw1xIF2p

Because this trade is not being split, I don't have the ExitDateTime for the partially filled trade. This is making the sorting of the fills a guess work.

Method 2: Using the orders with Filled status from sc.GetOrderByIndex()
The orders are not indexed by the LastActivityTime, I believe the default index is sorted by the time the order was placed. So, in order to put together a time sequence of fills I would have to first get all the orders for the day and sort them by the LastActivityTime inside my study. Once I have that, I can take the current position and go backwards in time until the position becomes zero. That would be the start of my trade. However, this is grossly inefficient because I have to go through all these steps each time I call the study and I have to figure out how many orders there in total by looping through sc.GetOrderByIndex() until it gives me an error. I can make minor efficiency changes but the partially filled orders can cause problems if I don't process all the orders each time.

I tried to save the buy fills into BuyPrice and BuyQuantity subgraphs and the sell fills into SellPrice and SellQuantity subgraphs in the study. This way the fills would automatically be time sequenced. However, this causes efficiency problems too because whenever I have an event that triggers processing of all orders again (such as partially filled orders or some old order getting filled much later), I have to first zero out all the subgraphs for each bar in the chart before populating them again.


I would really appreciate any guidance you can provide. Thanks.

Also, is there a technical issue or a licensing issue with your partners in providing access to the fills other than the fact that it would be considered as an enhancement? If you were to consider this enhancement, is it a lot of work to get it in and to test?

The fills are much more atomic than the orders and trades and they will naturally be in a time sequence and that is the most basic information the exchange provides. I am making a case to add this enhancement in the future. If you have further questions or if you have suggestions, please let me know.

Thanks.
[2014-04-26 04:58:54]
ejtrader - Posts: 688
+1 for whatever request QnReally is making here.

Thanks
[2014-04-26 10:56:54]
Sierra Chart Engineering - Posts: 104368
Method 1. We will look into what you are describing to make sure that this is by design and there are no problems. The split may not occur until there is a matching exit quantity.

We will add a function to obtain the order fills for the symbol of the chart.
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: 2014-04-26 10:57:32
[2014-04-26 14:45:39]
ejtrader - Posts: 688
SC Team - If there is a way to obtain the trade details from the very recent flat to current open position(there could be any scale-in / scale-outs in between) - that should be an ideal solution I would think. Probably like a new function - sc.scGetLatestTradeListEntry(). This would return '0' when flat and start accounting for entries/exits and would reset to '0' again once the position becomes '0'. Just a thought.

Thanks
Date Time Of Last Edit: 2014-04-26 14:47:20
[2014-04-26 21:49:24]
Sierra Chart Engineering - Posts: 104368
In regards to post #8 Method 1, we did find a minor problem with the splitting of an order fill when using Fill to Fill which will be resolved in the next release. Nothing that was causing incorrect results but not always completely consistent behavior.
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
[2014-04-27 14:39:57]
QnReally - Posts: 181
Thanks for the update. As you look to make this enhancement I would like to bring up two points:
1) It would be great to simply maintain the precision of the fill time that comes from the trading service for each fill. Unless SC's fills are always in the correct fill time order, any rounding of the fill time to the nearest second or whatever could introduce additional burden on the user study for figuring out the right sequence.

2) I would imagine each fill record would be final/immutable with respect to the quantity filled and the time of the fill regardless of whether it was a partial or a complete fill in relation to the order entered.

Thanks.
[2014-04-28 17:40:22]
Sierra Chart Engineering - Posts: 104368
1. Sierra Chart will store order fills and timestamp them according to the order received from the trading service. Order fills have time stamping down to the millisecond. And each millisecond is unique.

2. Yes.


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
[2014-05-04 14:48:56]
QnReally - Posts: 181
Thanks for the update. I was trying to see what the position quantity was and I am always getting a 1 during the replay of my charts regardless of my current position and regardless of if I am long or short. Is that expected?

s_SCPositionData PosData;
if (sc.GetTradePosition(PosData) != 1) return;
Buffer.Format("Position = %d", PosData.PositionQuantity); sc.AddMessageToLog(Buffer, 0);

This prints: Position = 1

The Chart Trade Window shows the correct position.

Unless I am doing something obviously wrong in the code, how can I reliably get the current position when I am in Live, Simulation, or Replay mode?

Thanks.
[2014-05-04 16:29:47]
QnReally - Posts: 181
Same is the case for sc.GetOrderFillSize(). It is returning a value of 2 during the replay regardless of how many fills I take.
[2014-05-05 20:13:39]
QnReally - Posts: 181
I might have made a mistake on this one. I am getting the position and the fills on simulation trades. I will double check on the replay and let you know if there is still a problem. For now, please ignore my previous comments. Thanks.

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

Login

Login Page - Create Account