Login Page - Create Account

Support Board


Date/Time: Thu, 06 Feb 2025 04:49:06 +0000



Post From: ACSIL - Check if there is an open stop loss order

[2020-04-13 08:11:54]
MattK - Posts: 42
Hi,

I'm trying to check if there is an open order without a stop loss at any point in time (because I had issues in the past in high volatility environment where an order was placed but the SL was not.

I tried the following:


int Index = -1; //to get the last order placed.

if(sc.GetOrderByIndex (Index, OrderDetails) != SCTRADING_ORDER_ERROR)
{
if(OrderDetails.OrderStatusCode == SCT_OSC_FILLED)
{
//Flatten and cancel positions here since the last order was filled (meaning there is no current open SL order.
}
}

I don't understand what I'm doing wrong here.

Also, is there a simpler way to check that? That'd be great!

Thanks in advance.
Date Time Of Last Edit: 2020-04-13 08:35:15