Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 02:54:11 +0000



Post From: Orders not Cancelling (fast replay) + Checking if existing working order or filled order

[2022-03-12 09:55:07]
SelimEker - Posts: 13
Hi everyone !

I know asking for programming might not be really popular here. But i need your input on this bit of code that I use to cancel my orders.

This bit of code seems to have some problem, whenever i do a replay at high speed. Any ideas why ?

Subgraph_BuyFill is basically saying if the Buy Conditions are filled (if == 1)
ActiveScalpPresent is a bool (global variable that i use to say if I have already entered a position.
The rest is self explanatory i imagine.

Also. Any ideas on how to check (programatically) whether there is already an order (that is placed (not filled) or in the market until exited) instead of using my global variable ?


if (EnabledCancel.GetYesNo())
  {
    s_SCTradeOrder ActiveScalpBuyOrder;
    sc.GetOrderByOrderID(BuyInternalOrderID, ActiveScalpBuyOrder);

    if ((Subgraph_BuyFill[sc.Index] != 1) && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED
      && ActiveScalpPresent == true && sc.GetOrderByOrderID(BuyInternalOrderID, ActiveScalpBuyOrder) != SCTRADING_ORDER_ERROR && ActiveScalpBuyOrder.OrderStatusCode != SCT_OSC_FILLED)
    {
      sc.CancelOrder(BuyInternalOrderID);
      ActiveScalpPresent = false;
      SCString DataString;
      DataString.Format("Buy Order Canceled due to condition changed, Scalp Is Available to use Now !");
      sc.AddMessageToLog(DataString, 1);
    }
  }

Date Time Of Last Edit: 2022-03-12 09:55:39