Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 04:54:12 +0000



Multiple buy trades per bar even if AllowOnlyOneTradePerBar is true

View Count: 332

[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;
}

[2023-09-24 10:25:37]
BenjFlame - Posts: 324
The issue was fixed by removing the study, then adding it back.
Building study and reloading chart was not enough to have those parameters taken into account after a change.
Date Time Of Last Edit: 2023-09-24 10:25:58

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account