Login Page - Create Account

Support Board


Date/Time: Tue, 21 May 2024 13:51:34 +0000



Post From: Implementing simple trailing stop and profit target in ACSIL

[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