Support Board
Date/Time: Sat, 11 Jan 2025 15:00:24 +0000
Post From: Simple trailing stop doesn't work for me
[2016-12-07 13:53:50] |
User788673 - Posts: 2 |
I'm trying an indicator based system with a trailing stop which seemed to be working just fine when I only made long positions. When I added the option to go short, the system refuses to go short, and instead only keeps going long during backtesting. In fact I get "Sell Entry signal is ignored because maximum short position allowed has been reached or would be exceeded with the new order.Max positon allowed: 20. Resulting position with working orders: -21. Resulting position with Market working orders: 0" message from the message log. The problem is that even if I increase the maximum position allowed, the program still only goes long. So I know you don't help with programming, I just want to ask if the following lines might ellicit an error, otherwise I'll figure it out on my own. In the sc.SetDefaults I am seting these variables to true: sc.AllowMultipleEntriesInSameDirection = true; sc.AllowEntryWithWorkingOrders = true; sc.MaximumPositionAllowed = 20; And when I make an order (either for BuyEntry or SellEntry) I do this: s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; NewOrder.Target1Offset = 10*sc.TickSize; NewOrder.StopAllOffset = 21*sc.TickSize; NewOrder.AttachedOrderStopAllType = SCT_ORDERTYPE_TRAILING_STOP; Date Time Of Last Edit: 2016-12-07 13:54:06
|