Login Page - Create Account

Support Board


Date/Time: Fri, 24 Jan 2025 20:40:24 +0000



sc.GetNearestTargetOrder() and sc.GetNearestStopOrder() fails to find working orders

View Count: 825

[2019-01-28 14:23:26]
User287992 - Posts: 51
sc.GetNearestTargetOrder() and sc.GetNearestStopOrder() returns 0 altough I have Stop and Target orders working in chart in OCO group:

if (PositionData.PositionQuantityWithAllWorkingOrders != 0) {
  Result = sc.GetNearestTargetOrder(Order);

  Buffer.Format("%s | Result target: %d", sc.DateTimeToString((double)sc.LatestDateTimeForLastBar, FLAG_DT_COMPLETE_DATETIME).GetChars(), Result);
  sc.AddMessageToLog(Buffer, 0); // prints "Result target: 0"

  Result = sc.GetNearestStopOrder(Order);

  Buffer.Format("%s | Result stop: %d", sc.DateTimeToString((double)sc.LatestDateTimeForLastBar, FLAG_DT_COMPLETE_DATETIME).GetChars(), Result);
  sc.AddMessageToLog(Buffer, 0); // prints "Result stop: 0"
}

http://www.sierrachart.com/image.php?Image=1548684994406.png

SC 1865
Private File
[2019-01-28 17:07:23]
Sierra Chart Engineering - Posts: 104368
If they are not Attached Orders they would not be returned in older versions of Sierra Chart, but in newer versions they will. So update to the current version.

Also you need to make sure that this setting is set correctly as documented:
Automated Trading Management: SendOrdersToTradeService

It should be set to 0 in your case.
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: 2019-01-28 17:08:39
[2019-02-01 18:38:50]
User287992 - Posts: 51
Tested on up to date version 1865 as mentioned.

Orders are attached and on Sim as shown in attached csv Orders and Positions list with no connected trading service.
[2019-02-04 12:21:23]
User287992 - Posts: 51
Nevermind, found a problem in my code.

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

Login

Login Page - Create Account