Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 04:50:01 +0000



Post From: Multiple buy trades per bar even if AllowOnlyOneTradePerBar is true

[2023-09-24 08:44:47]
BenjFlame - Posts: 324
Hi,
this is in the context of a replay of a single chart, with an ASCIL system attached to it.
It will create as much buy orders on the same bar as allowed by MaximumPositionAllowed. So when the bar ends I'm in with 20 long positions.

Isn't 'AllowOnlyOneTradePerBar' supposed to absolutely prevent multiple orders in same direction on same bar?

here are my defaults:


// Trading setup options
sc.SendOrdersToTradeService = Input_SendOrdersToTradeService.GetBoolean();
sc.AllowMultipleEntriesInSameDirection = true;
sc.AllowOppositeEntryWithOpposingPositionOrOrders = false;
sc.CancelAllOrdersOnEntriesAndReversals = false;
sc.AllowEntryWithWorkingOrders = true;
sc.SupportReversals = true;
sc.AllowOnlyOneTradePerBar = true; // Allows both buy and sell side, jut not several buys or sells
sc.MaximumPositionAllowed = 20;
sc.MaintainTradeStatisticsAndTradesData = true;

Here is buy code:


if (Subgraph_Power_Bull_Bar[sc.Index])
{
s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 1;
NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
NewOrder.Target1Offset = averageHighLow * Input_TargetFactor.GetFloat();
NewOrder.Stop1Offset = averageHighLow * Input_StopFactor.GetFloat();
int Result = sc.BuyEntry(NewOrder);


// Trade didn't pass. Don't log.
if (Result < 0)
{
CreateMessageLog(sc, "BuyEntry Equi Manual: Trade didn't pass");
}
else
{
CreateMessageLog(sc, "BuyEntry Equi Manual: Trade OK");
}

return;
}