Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 16:42:43 +0000



Post From: sc.SellEntry and sc.SellExit for a STOP_LIMIT_ORDER

[2016-04-02 13:16:21]
@sstfrederik - Posts: 404
General code looks like below. Seems that price1 of object MyOrder is not remembered.

//market order object
s_SCNewOrder MyOrder;
MyOrder.TimeInForce = SCT_TIF_GTC;
MyOrder.OrderQuantity = PositionSize;
MyOrder.OrderType = SCT_ORDERTYPE_STOP_LIMIT;
MyOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
MyOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP;

if(somecondition){
MyOrder.Stop1Offset = something;
MyOrder.Target1Offset = something;
MyOrder.Price1 = myprice;
sc.BuyEntry(MyOrder);


}


if(someotherconditionatsomeothertime){
sc.BuyExit(MyOrder);

}



If I place price1 in a persistent float and declare it again before calling BuyExit. It seems to work. Is this the correct approach?

thanks.