Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 04:44:14 +0000



[Programming Help] - How to attached a custom name to an order using s_SCNewOrder::TextTag?

View Count: 390

[2025-03-06 02:56:46]
LTSys2 - Posts: 9
I checked if result was an error code


  int result = static_cast<int>(sc.BuyOrder(order));
  
  message.Format("error code: %u message: %s", result, sc.GetTradingErrorTextMessage(result));
  
  sc.AddMessageToLog(message, 0);

And got this output...

error code: 4294958298 message: Order entry skipped because full recalculation
Date Time Of Last Edit: 2025-03-06 03:01:21
[2025-03-06 03:34:40]
ondafringe - Posts: 322
I believe SC recommends placing this below the Set Defaults block of code:

if (sc.IsFullRecalculation)
return;

Maybe that will help.
Date Time Of Last Edit: 2025-03-06 04:36:27
[2025-03-06 05:01:54]
LTSys2 - Posts: 9
Thanks for pointing that out. The basic study code was able to place an order with a successful text tag.

But when the exact same code places an order from a class, the order has an empty text tag?

Thanks for the help btw.
[2025-03-06 11:17:57]
User431178 - Posts: 649

result comes back as 4294958298

Docs say...

Returns: A return value > 0 indicates the order was successfully submitted. If the value is > 0, then this value indicates the quantity of the submitted order. If the return value is negative, < 0, the order submission was ignored.

The code submitted 1000 not 4294958298!

And no order is being placed?

And it should have fallen into this code block but it doesn't?

if(static_cast<int>(sc.BuyOrder(order)) > 0)

Weird stuff going on!



int result = static_cast<int>(sc.BuyOrder(order));

message.Format("error code: %u message: %s", result, sc.GetTradingErrorTextMessage(result));
sc.AddMessageToLog(message, 0);


error code: 4294958298 message: Order entry skipped because full recalculation

%u (unsigned int) is wrong in this case, should be %i or %d for signed int.
-8998 signed is same bit pattern as 4294958298 unsigned.




Thanks for pointing that out. The basic study code was able to place an order with a successful text tag.
But when the exact same code places an order from a class, the order has an empty text tag?

You have two test cases, one successful, one not, therefore they cannot be exactly the same, that is illogical.
Either there is an difference in the implementation of your class, or there is some subtle difference in what you are doing and/or what the called code is doing.

I am going to guess that the working test case was sending an order for the same symbol/account as the chart, whereas the non-working case was sending an order for a different symbol/account.
Why that yields a different outcome I don't know, as it doesn't seem to be explicitly documented, however it probably explains your problem (maybe you should ask SC engineering about it).
[2025-03-06 13:49:58]
LTSys2 - Posts: 9
%u (unsigned int) is wrong in this case, should be %i or %d for signed int.

Thanks I missed that.

it doesn't seem to be explicitly documented, however it probably explains your problem (maybe you should ask SC engineering about it)

I think it's reached that point.

Thanks to everyone for their help!

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

Login

Login Page - Create Account