Support Board
Date/Time: Sun, 24 Nov 2024 05:27:26 +0000
Post From: Acsil: Limit order to exit a long position, how ?
[2024-07-01 12:57:19] |
BenjFlame - Posts: 324 |
Hi, a position is entered with such code: s_SCNewOrder NewOrder; NewOrder.OrderQuantity = sc.TradeWindowOrderQuantity; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; NewOrder.Target1Offset = sc.TickSize * Input_DefaultTargetTickDistance.GetInt(); NewOrder.Stop1Offset = sc.TickSize * Input_DefaultStopTickDistance.GetInt(); int Result = sc.BuyEntry(NewOrder); How to create new code to place limit order to exit that position at entryprice + 3 ticks ? Attempt with such code: s_SCNewOrder NewOrder; NewOrder.OrderQuantity = Quantity; // This is defined elsewhere NewOrder.OrderType = SCT_ORDERTYPE_LIMIT; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; NewOrder.Price1 = entryPrice + sc.TickSize * 3; int Result = sc.BuyExit(NewOrder); fail |