Login Page - Create Account

Support Board


Date/Time: Thu, 16 May 2024 12:23:05 +0000



ACSIL - List Closed Orders

View Count: 3558

[2015-06-30 02:58:52]
ejtrader - Posts: 688
SC Team - I am trying to list most recent orders that matches the Trade Activity Log - InternalOrderID & ServiceOrderID.

I have been trying to use the following with no success. Any hints?

if I take out SCTRADING_ORDER_ERROR - for all orders InternalOrderID shows up as '0'.


int Index = 0;
s_SCTradeOrder OrderDetails;
while (sc.GetOrderByIndex(Index++, OrderDetails) != SCTRADING_ORDER_ERROR) {
// Print OrderDetails.InternalOrderID -- This doesn't seem to execute
}

Date Time Of Last Edit: 2015-06-30 05:09:10
[2015-06-30 03:27:46]
ejtrader - Posts: 688
Alternately - If I need to use sc.GetOrderByOrderID - I would need the OrderIDs - min/max OrderIDs to iterate through. The above function doesn't return OrderIDs.

Is there any solution to this issue? Would like to list all the "closed" orders.

thanks
Date Time Of Last Edit: 2015-06-30 05:04:37
[2015-06-30 19:04:18]
ejtrader - Posts: 688
SC Team - Would you please let me know the way to figure out the internal order ID (historical) - based on the instrument being traded?

Is there any function available for it?

Thanks
[2015-07-01 07:48:59]
Sierra Chart Engineering - Posts: 104368
One way to determine internal order IDs is to iterate through all of the orders with sc.GetOrderByIndex.

The first question is, is the order you are looking for listed in Trade >> Trade Orders and Positions >> Orders?

Also make sure that sc.SendOrdersToTradeService is set correctly. sc.GetOrderByIndex depends upon it.
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: 2015-07-01 08:12:57
[2015-07-01 08:12:43]
Sierra Chart Engineering - Posts: 104368
Here is the updated documentation for this function:
http://www.sierrachart.com/index.php?page=doc/doc_ACSILTrading.html#GetOrderByIndex
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
[2015-07-01 14:14:24]
ejtrader - Posts: 688
Thank you SC Team. I seem to be making progress on this. This was related to "sc.SendOrdersToTradeService" flag.

On a side note - If I have the following statement in GDI function call - It seem to cause the following error message. this is no big deal as I can use alternative work arounds. But thought of bringing to your attention if there is something obvious is wrong or this function is not intended for GDI function.

thanks

An unhandled exception was caught in c_Chart::WindowProc. Message: 15, wParam: 0, lParam: 0 | 2015-07-01 09:11:01 *


s_SCTradeOrder OrderDetails;

sc.GetOrderByIndex(0, OrderDetails); // Isolated to this statement that causes the unhandled exception

Date Time Of Last Edit: 2015-07-01 14:23:17
[2015-07-01 17:42:53]
Sierra Chart Engineering - Posts: 104368
This function can be used from the GDI drawing function.

We have determined the source of the problem and it will be corrected in the next release.
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
[2015-07-01 23:22:30]
ejtrader - Posts: 688
SC Team - Thanks for taking care of it. Would be looking forward to version 1267.

is there any function to read the RTCommission information which is stored in Global Symbol settings?

thanks
[2015-07-02 03:23:31]
Sierra Chart Engineering - Posts: 104368
We will add sc.RoundTurnCommission as an ACSIL member in the next release.
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
[2015-07-02 13:40:33]
ejtrader - Posts: 688
SC Team - Some feedback on this.

- sc.GetOrderByIndex(0, OrderDetails); -- this now works fine from GDI function call. Thanks
- sc.RoundTurnCommission - This works fine if direct symbol is used from trading service(data also from local), but not with remote data/local trade service.

thanks
[2015-07-02 13:55:42]
Sierra Chart Engineering - Posts: 104368

- sc.RoundTurnCommission - This works fine if direct symbol is used from trading service(data also from local), but not with remote data/local trade service.
This probably does make sense and will not change.
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
[2015-07-02 14:00:47]
ejtrader - Posts: 688
Thanks. Makes sense.

One more question:

sc.GetTradeStatisticsForSymbol() - For daily stats - Do these trades include from mid-night to mid-night(it appears like mid-night to mid-night) or based on the Chart Session times? If this is indeed mid-night to mid-night - is there any way an additional option can be given to make this from sc.StartTime1 ?

thanks
Date Time Of Last Edit: 2015-07-02 14:01:13
[2015-07-05 14:41:39]
ejtrader - Posts: 688
SC Team - Noticed one calculation discrepancy with Trade Activity Log -> Trades (tab)

- Entry Efficiency - the calculation is correct and you don't include Commission in this
- Exit Efficiency / Total Efficiency - You seem to include the Commission in this logic and probably not the correct way to do it.
- Commissions should be ONLY included in the P/L and Cumulative P/L.
- "efficiency" fields technically shouldn't include commissions in calculations.

No big deal whether you make changes related to this or not but thought of bringing this to your attention.

Thanks
Date Time Of Last Edit: 2015-07-05 14:52:10
[2015-07-05 15:13:39]
ejtrader - Posts: 688
By the way - My original problem of Unable to fetch the InternalOrderID's for the Closed orders remain the same. It only fetches the "Open" Orders. I have tested this with Live account / sim account / replay Account. All of them - I get the internalOrderID for Open Orders and not the Closed Orders.


if (sc.SetDefaults) {
sc.MaintainTradeStatisticsAndTradesData = true;
sc.SendOrdersToTradeService = !sc.GlobalTradeSimulationIsOn;
}

Though I don't have any filter in this while loop - it ONLY lists the Open Orders and NOT closed Orders

int Index = 0;
s_SCTradeOrder OrderDetails;

while( sc.GetOrderByIndex(Index, OrderDetails) != SCTRADING_ORDER_ERROR)
{
Index++;
//Print Internal Order ID - this ONLY prints the Open Orders (I don't have any other logic here to filter the trades)
}


I can get the all the details of the closed trades from here but unfortunately this structure doesn't have internalOrderID.


std::vector <s_ACSTrade> TradesList;

s_ACSTrade TradeEntry;
int Size = sc.GetTradeListSize();

for(int Index = 0; Index < Size;Index++)
{
if(sc.GetTradeListEntry(Index, TradeEntry))
TradesList.push_back(TradeEntry);
}

for (unsigned int TradeIndex = 0; TradeIndex < TradesList.size(); TradeIndex++)
{
// Print All Order details - This lists all the Closed Orders Correctly - but There is no OrderID available with this data
}

Date Time Of Last Edit: 2015-07-05 15:23:26
[2015-07-05 20:39:09]
Sierra Chart Engineering - Posts: 104368
Post 12: Refer to the updated documentation.

Post 13: We will have a look at this.

Post 14: We would think the answer for this is obvious and is actually documented. If you do not see the orders listed in the Trade >> Trade Orders and Positions >> Orders tab within Sierra Chart, they are not available and you will not get them.
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
[2015-07-05 21:35:15]
Al SC Developer - Posts: 434
Post 13: The efficiency calcs will be changed in the next version to not include commissions.
[2015-07-06 03:23:12]
ejtrader - Posts: 688
Post 12 - OK - I understand now about the limitation. Historical OrderID's can't be pulled as the trades are NOT actually available in Trade -> Trade Orders and Position (as they are NO longer active) - Would find an alternate solution for this.

Post 13 - Thanks for correcting the efficiency calculations. On a side note - Optionally You might want to include the MAE / MFE calculations as well in the list ( I am calculating them through ACSIL ) - But few of them might find it useful. Your call on whether to include them or not :)


const double MAE = abs(worstPrice - TradesList[TradeIndex].AverageEntryPrice) * TradesList[TradeIndex].EntryQuantity;
const double MFE = abs(bestPrice - TradesList[TradeIndex].AverageEntryPrice) * TradesList[TradeIndex].EntryQuantity;

Post 14 - Thanks. Could adjust the time accordingly. For me - no issues using a generic time for this as I only use CME products to trade and can set to 17:00 CT.
However a generic approach might be a preferred one as the start time varies from instrument to instrument. Probably a good idea to pick sc.StartTime1 for this as it would make it more generic. Your call in the end as well on this.

Thank you SC Team for all the help in this thread. No more open questions on these topics at this time.

Thanks
Date Time Of Last Edit: 2015-07-06 03:23:46
[2015-07-06 03:55:07]
Al SC Developer - Posts: 434
MAE / MFE are available as Drawndown and Runup. These are PL numbers, so do optionally include the commissions.
[2015-07-09 03:36:05]
ejtrader - Posts: 688
Edited - (removed the comment as it was an incorrect assumption on my part).

thanks
Date Time Of Last Edit: 2015-07-09 04:23:33
[2015-07-09 04:56:34]
Sierra Chart Engineering - Posts: 104368
enum OpenCloseEnum
{ OCE_UNDEFINED
, OCE_OPEN
, OCE_CLOSE
};
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
[2015-07-09 15:00:31]
ejtrader - Posts: 688
SC Team - Need one more clarification related to position information.

I am trying to account for "external" events like - calling a broker or using another temporary platform to "change" a position. Wanted to account for accurate information for position.

But trying to understand how frequently this is managed internally.

Though I can always use "Refresh Trade Data from Service" manually - wondering if there is any ACSIL function available for "Refresh Trade Data from Service". If so as a security measure - I can run it periodically to account for these conditions.

thanks in advance.
Date Time Of Last Edit: 2015-07-09 16:43:19
[2015-07-09 18:10:33]
Sierra Chart Engineering - Posts: 104368
There is no ACSIL function for Trade >> Refresh Trade Data from Service and we would not add that. There is not a usual condition why that would need to be used. And in some cases it has no effect anyway for Trade Positions due to how Positions are determined for some Trading services.
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: 2015-07-09 18:11:05
[2015-07-09 20:13:42]
ejtrader - Posts: 688
Agreed. Certainly unusual.

Would you please confirm - how frequently positiondata is updated ? By any chance does it also try to synchronize internal calculated/broker position data. It is understood that there are certain conditions this might not match up - just trying to know if does "attempt" to synchronize as part of sc.GetTradePosition call.


Thanks
[2015-07-09 22:23:16]
Sierra Chart Engineering - Posts: 104368
Actually we are mistaken, ACSIL does have sc.RefreshTradeData which is the same thing.

The Internal Position data and the "Service" position data are always synchronized. And the Service Trade Position data is updated as frequently as the Trading service sends it.
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: 2015-07-09 22:23:43
[2015-07-12 20:26:13]
ejtrader - Posts: 688
Question - Orders Position Data is not populated during reply.

Edit - Never mind this works fine - when I use "Standard Replay" ( vs using Accurate Trading system Backtest Mode - which I was using earlier ).

Thanks
Date Time Of Last Edit: 2015-07-12 20:57:38

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

Login

Login Page - Create Account