Support Board
Date/Time: Tue, 03 Dec 2024 19:19:07 +0000
[User Discussion] - Error message due to
View Count: 2010
[2013-04-12 19:42:30] |
VFdemo54 - Posts: 1 |
Hi there, Is there a way to avoid entering position on the same bar? The Message log is full of messages like this: Order Action is ignored because sc.AllowOnlyOneTradePerBar is TRUE and a signal for the same Order Action (SellEntry) was already given on the bar. What am I missing in my code? // CROSSOVER
// if (!Enabled.GetYesNo()) return; SCFloatArrayRef Last = sc.Close; // Use persistent variables to remember attached order IDs so they can be modified or canceled. int& Target1OrderID = sc.PersistVars->i1; int& Stop1OrderID = sc.PersistVars->i2; // Create an s_SCNewOrder object. s_SCNewOrder NewOrder; NewOrder.OrderQuantity = InputSize.GetInt(); NewOrder.OrderType = SCT_MARKET; //Specify a Target and a Stop with 8 tick offsets. We are specifying one Target and one Stop, additional targets and stops can be specified as well. NewOrder.Target1Offset = (InputTarget.GetInt())*sc.TickSize; NewOrder.Stop1Offset = (InputStop.GetInt())*sc.TickSize; NewOrder.OCOGroup1Quantity = 0; // If this is left at the default of 0, then it will be automatically set. Buy[sc.Index] = 0; Sell[sc.Index] = 0; if (sc.CrossOver(TPZeroLagTEMA, HAZeroLagTEMA) == CROSS_FROM_BOTTOM) { Buy[sc.Index] = sc.Low[sc.Index] - sc.TickSize; int Result = sc.BuyEntry(NewOrder); if (Result > 0) //If there has been a successful order entry, then draw an arrow at the low of the bar. { // Remember the order IDs for subsequent modification and cancellation Target1OrderID = NewOrder.Target1InternalOrderID; Stop1OrderID = NewOrder.Stop1InternalOrderID; } } else if (sc.CrossOver(TPZeroLagTEMA, HAZeroLagTEMA) == CROSS_FROM_TOP) { Sell[sc.Index] = sc.High[sc.Index] + sc.TickSize; int Result = sc.SellEntry(NewOrder); if (Result > 0) // Remember the order IDs for subsequent modification and cancellation Target1OrderID = NewOrder.Target1InternalOrderID; Stop1OrderID = NewOrder.Stop1InternalOrderID; } The ther problem is this: SellEntry signal is ignored because a Short position exists or working order quantities indicate a potential Short position, and Multiple Entries in Same Direction is not enabled. Internal position quantity: -1. Internal position with working orders quantity: 0 Date Time Of Last Edit: 2013-04-12 19:43:10
|
To post a message in this thread, you need to log in with your Sierra Chart account: