Support Board
Date/Time: Fri, 14 Mar 2025 12:56:23 +0000
Bug in sc.GetFlatToFlatTradeListEntry()
View Count: 818
[2022-04-11 09:34:48] |
Trader & Sierra++ developer - Posts: 110 |
Hi Sierra, There is a problem with sc.GetFlatToFlatTradeListEntry() : EntryQuantity and ExitQuantity are always set to MaxOpenQuantity during the life of the ftf trade. Let's take an example, starting flat : BUY 1 => EntryQuantity=1, ExitQuantity=1, MaxOpenQuantity=1 BUY 1 => EntryQuantity=2, ExitQuantity=2, MaxOpenQuantity=2 SELL 1 => EntryQuantity=2, ExitQuantity=2, MaxOpenQuantity=2 SELL 1 => EntryQuantity=2, ExitQuantity=2, MaxOpenQuantity=2 Actually, whatever you do, you always get EntryQuantity = MaxOpenQuantity and ExitQuantity = MaxOpenQuantity. At each step, the Trade Activity Log window shows correct data. I discovered this using a recent SC version ; I've just updated to the last one (2382) and have the exact same issue. + another bug : the AverageExitPrice starts at 0 and then stays fixed to the first exit price. |
[2022-04-11 11:10:19] |
|
First thing to understand is the data structure that is being used for a flat a flat trade, the naming of these variables may not be technically correct. The data structure was originally used for a fill to fill trade and the variables were not renamed, after updates to the Trades tab of the Trade Activity Log. We will rename them now. This will cause compiler errors though. ExitQuantity is actually the Maximum Close Quantity. We are making some adjustments to match up with the Trade Activity Log. 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: 2022-04-11 12:16:49
|
[2022-04-11 15:17:54] |
Trader & Sierra++ developer - Posts: 110 |
I got the new version. Now it works, but I can't know wether a ftf trade is open or is closed. Example : BUY => TradeQty=1, MaxOpenQty=1, MaxClosedQty=0 BUY => 2/2/0 SELL => 2/2/1 BUY => 3/2/1 SELL => 3/2/2 SELL => 3/2/2 = same as previous Is it possible to get that information or not ? In the Trade Activity Log it is possible to get this information. |
[2022-04-11 15:49:06] |
|
Check again. We cannot reproduce this issue. Make sure the trade is actually closed. MaxClosedQuantity is getting set when using this function: sc.GetFlatToFlatTradeListEntry 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 |
[2022-04-11 19:05:28] |
Trader & Sierra++ developer - Posts: 110 |
I confirm the issue. I tried with a dedicated test study (code below), on different symbols, and using both trade simulation mode and a 'real' trading service (SC trade simuator service with a freshly created account). The following sequence gives no way to know if the current ftf trade is open or closed : BUY => TradeQty=1, MaxOpenQty=1, MaxClosedQty=0 BUY => 2/2/0 SELL => 2/2/1 BUY => 3/2/1 SELL => 3/2/2 SELL => 3/2/2 = same as previous Here is my code for testing : #define _LOG_M(...) {SCString msg;msg.AppendFormat(__VA_ARGS__);sc.AddMessageToLog(msg, 0);} SCSFExport scsf_Test(SCStudyInterfaceRef sc){ if (sc.SetDefaults){ sc.FreeDLL = 1; sc.GraphName = "Test"; sc.AutoLoop = 0; sc.MaintainTradeStatisticsAndTradesData = true; sc.GraphRegion = 0; return; } int size = sc.GetFlatToFlatTradeListSize(); _LOG_M("starting loop %d", size); for (int i = size; i > 0; i--){ s_ACSTrade currTrade; if (sc.GetFlatToFlatTradeListEntry(i-1, currTrade)) _LOG_M("q=%.2f moq=%.2f mcq=%.2f", currTrade.TradeQuantity, currTrade.MaxOpenQuantity, currTrade.MaxClosedQuantity); } } I guess there should be another field to give that information as in the Trade Activity Log. Date Time Of Last Edit: 2022-04-11 19:07:01
|
[2022-04-11 23:02:35] |
Trader & Sierra++ developer - Posts: 110 |
Since I installed v2383 this afternoon, and after the successful recompilation of all my studies with the new API, I've had so many crashes that I just rolled back to v2382. I don't know what causes all that stuff. What I can tell you is that I never had a single crash before. My studies are stable and I know what I'm doing with pointers & memory. I'm stopping all my work on SierraChart until I have more information. FYI the most crashes I got were on the Trade Simulator data service. It's more stable using the trade simulation mode (but It still crashes sometimes). And in the past days (versions < 2382) all was perfectly stable on SIM and real trading account. Date Time Of Last Edit: 2022-04-11 23:03:48
|
[2022-04-12 06:33:08] |
|
This issue must be with your custom studies DLL. Refer to help topic 17: Sierra Chart Unexpectedly Shutting Down | Memory Errors | Unusual Software Problems | Exception Errors | Freezing of User Interface The first thing to do is to run Sierra Chart in Safe Mode to rule out the custom studies DLL. It really does not make sense the issue is in the newer versions. 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: 2022-04-12 06:34:11
|
[2022-04-12 10:14:38] |
Trader & Sierra++ developer - Posts: 110 |
With the help of VC++ debugger i found out the reason of those crashes : after changing the trading service and opening & closing trades without translating the symbol, GetRealtimeSymbol() (which is not documented but from my tests figured out to be the only way to retrieve the real traded symbol) returns nothing and my warning message using Format() had just a missing letter after the %... Wow. A case I had not tested when coding my studies. Back to the main issue that is still there : using sc.GetFlatToFlatTradeListEntry(), how to know if a trade is open or closed ? In my understanding it is NOT possible even if it IS possible in the Trade Activity Log. Date Time Of Last Edit: 2022-04-12 12:52:10
|
[2022-04-12 13:30:04] |
Trader & Sierra++ developer - Posts: 110 |
+ it is even NOT possible to get that information using sc.GetTradeListEntry() and rebuilding ftf trades After a day lost reading the doc and testing, I'm stuck trying to know if a ftf trade from xxxTradeListEntry() is open or closed... That's crazy Please help and give a simple and reliable way Date Time Of Last Edit: 2022-04-13 07:54:41
|
[2022-04-13 13:23:54] |
|
We will add a field for this: After a day lost reading the doc and testing, I'm stuck trying to know if a ftf trade from xxxTradeListEntry() is open or closed. 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 |
[2022-06-04 17:24:56] |
Trader & Sierra++ developer - Posts: 110 |
Hi Sierra, When do you plan to add the field ? It's important to be able to plan & organize. thanks |
[2022-06-05 06:57:22] |
|
This has already been added: int s_ACSTrade::IsTradeClosed = 0;
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: