Login Page - Create Account

Support Board


Date/Time: Sat, 05 Jul 2025 08:49:06 +0000



Post From: Multiple Trades Per Bar

[2018-08-07 11:11:12]
rahul - Posts: 173
Hello,

I am aware that sc.SupportReversal = true will help reverse a trade even when sc.AllowOnlyOneTradePerBar = true

Suppose I need to exit 1 open contract (BuyExit after this open quantity = 0) and enter 2 new contracts (SellEntry) on the same bar instantly, what's the best way of doing so? Can someone please write that code for me. Much appreciated.

Currently my code is (for reversing 1 contract) on Bar Close using sc.GetBarHasClosedStatus(sc.Index) == BHCS_BAR_HAS_CLOSED:
sc.AllowMultipleEntriesInSameDirection = false;
sc.MaximumPositionAllowed = 2;
sc.SupportReversals = true;
sc.AllowOppositeEntryWithOpposingPositionOrOrders = false;
sc.SupportAttachedOrdersForTrading = false;
sc.CancelAllOrdersOnEntriesAndReversals = true;
sc.AllowEntryWithWorkingOrders = false;
sc.CancelAllWorkingOrdersOnExit = true;
sc.AllowOnlyOneTradePerBar = true;
sc.MaintainTradeStatisticsAndTradesData = true;

s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 1;
NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
sc.SellEntry(NewOrder);
Date Time Of Last Edit: 2018-08-07 16:06:42