Support Board
Date/Time: Sat, 11 Jan 2025 22:16:34 +0000
Implementing simple trailing stop and profit target in ACSIL
View Count: 2332
[2017-01-12 18:45:31] |
User514837 - Posts: 47 |
I am trying to simply enter the market using ACSIL, by using a simple trailing stop (let's say 10 ticks) and a target of 20 ticks. I don't want attached orders, because I think attached orders makes your orderquantity at least 2. Is the following doing what I would like to do? Simple trailing stop of 10 ticks and target profit of 20 ticks? s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.Price1 = sc.BaseData[SC_LAST][sc.Index] + 10*sc.TickSize; NewOrder.Target1Offset = 20 * sc.TickSize; |
[2017-01-12 20:08:27] |
Sierra Chart Engineering - Posts: 104368 |
Did you want to enter using a market order?
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 |
[2017-01-12 20:11:23] |
User514837 - Posts: 47 |
By market order do you mean enter immediately at current market price? Then yes.
|
[2017-01-12 21:22:11] |
Sierra Chart Engineering - Posts: 104368 |
Here is an example: s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; //Specify a Target and a Stop with 8 tick offsets. We are specifying one Target and one Stop, additional targets and stops can be specified as well. NewOrder.Target1Offset = 8*sc.TickSize; NewOrder.Stop1Offset = 8*sc.TickSize; NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.OCOGroup1Quantity = 1; // If this is left at the default of 0, then it will be automatically set. You do need to use Attached Orders to put a Target and Stop. There is no other way. 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: 2017-01-12 21:58:58
|
[2017-01-12 21:24:10] |
User514837 - Posts: 47 |
There's no trailing stop in the above code, I would be looking to have a trailing stop.
Date Time Of Last Edit: 2017-01-12 21:26:02
|
[2017-01-12 21:58:22] |
Sierra Chart Engineering - Posts: 104368 |
We apologize for missing that detail. The code example is now updated.
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 |
[2017-01-16 13:31:22] |
User514837 - Posts: 47 |
Keeping in mind I want a trailing stop, what is the difference between using the code that you recommended: ewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; NewOrder.Target1Offset = 8*sc.TickSize; NewOrder.Stop1Offset = 8*sc.TickSize; NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.OCOGroup1Quantity = 1; // If this is left at the default of 0, then it will be automatically set. and NewOrder.OrderType = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.Price1 = sc.BaseData[SC_LAST][sc.Index] + 10*sc.TickSize; NewOrder.Target1Offset = 20 * sc.TickSize; I see in backtests that using Price1 doesn't always hold, and trades don't get exited when they should. Is that the difference? Date Time Of Last Edit: 2017-01-16 13:33:16
|
[2017-01-16 19:37:21] |
Sierra Chart Engineering - Posts: 104368 |
The difference is that the second block of code is a trailing stop for the main order. And it has no attached Stop.
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: