Login Page - Create Account

Support Board


Date/Time: Mon, 24 Feb 2025 19:15:31 +0000



[Programming Help] - How to set Price1 few ticks higher

View Count: 609

[2021-03-22 05:06:08]
User641030 - Posts: 13
I'm new to Sierra chart ascil programming. So apologies if this is already covered in your documentation.

I've reproduced a portion of the code that I'm having trouble with.

BuyOrder.OrderQuantity = 1;
BuyOrder.OrderType = SCT_ORDERTYPE_LIMIT;
BuyOrder.Price1 = sc.High[sc.Index] + 2 * sc.TickSize;
BuyOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;

The BuyEntry price always defaults to sc.High of the current bar. I tried to hardcode a price but it ignores and takes sc.High[sc.Index] instead.

I'm running in sim mode. I've also set Target and Stop for the same order.

Appreciate any help!.
[2021-03-22 06:09:42]
Flipper_2 - Posts: 57
try

BuyOrder.Price1 = sc.High[sc.Index] + (2 * sc.TickSize);

[2021-03-22 08:45:58]
User907968 - Posts: 833
You are trying to submit a buy limit order above current price, in which case it will fill immediately at the current best ask.

The order types are explained here - Order Types
[2021-03-22 08:56:09]
Flipper_2 - Posts: 57
You are trying to submit a buy limit order above current price, in which case it will fill immediately at the current best ask.

Ha! Yes didn't notice that. So the order type should probably be,
BuyOrder.OrderType = SCT_ORDERTYPE_STOP;

If you want the order to trigger if it trades 2 ticks above the current high.
[2021-03-23 13:08:50]
User641030 - Posts: 13
Thanks a lot. Will try with the stop order type.

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

Login

Login Page - Create Account