Support Board
Date/Time: Thu, 16 Jan 2025 00:12:14 +0000
Post From: Unable to reverse entries
[2017-09-12 15:50:19] |
User203925 - Posts: 40 |
I would like for my code to reverse entries but right now I am unable to get it to work. The code does short / long but does not reverse. Here is my code and defaults. Any help would be appreciated. I have been at this for 2 days and for some reason I can't get this to work. sc.GraphRegion = 0; sc.AutoLoop = true; sc.FreeDLL = 1; sc.AllowMultipleEntriesInSameDirection = false; sc.AllowOnlyOneTradePerBar = true; sc.MaintainTradeStatisticsAndTradesData = true; sc.AlertOnlyOncePerBar = true; sc.SupportReversals = true; //sc.MaximumPositionAllowed = 5; sc.AllowOppositeEntryWithOpposingPositionOrOrders = false; sc.CancelAllOrdersOnEntriesAndReversals = true; sc.AllowEntryWithWorkingOrders = false; sc.CancelAllWorkingOrdersOnExit = true; NewOrder.OrderQuantity = OrderQuantity.GetInt(); NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; s_HardStop = (LowestLow[sc.Index] - (StopTickOffset.GetInt() * sc.TickSize)); b_HardStop = (HighestHigh[sc.Index] + (StopTickOffset.GetInt() * sc.TickSize)); TargetPrice1 = (TargetLimit.GetInt()* sc.TickSize); if (DB[sc.Index] == 1 && DT[sc.Index] == 0) { TradePrice = sc.BaseData[SC_LAST][sc.Index]; int Result = sc.BuyOrder(NewOrder); if (Result > 0 && NewOrder.InternalOrderID != 0) { Target1OrderID = NewOrder.Target1InternalOrderID; Stop1OrderID = NewOrder.StopAllInternalOrderID; EntryID = NewOrder.InternalOrderID; } if (DT[sc.Index] == 1 && DB[sc.Index] == 0) { s_TradePrice = sc.BaseData[SC_LAST][sc.Index]; NewOrder.Target1Offset = TargetPrice1; NewOrder.StopAllPrice = b_HardStop; NewOrder.OCOGroup1Quantity = 1; int Result = sc.SellOrder(NewOrder); if (Result > 0 && NewOrder.InternalOrderID != 0) { Target1OrderID = NewOrder.Target1InternalOrderID; Stop1OrderID = NewOrder.StopAllInternalOrderID; EntryID = NewOrder.InternalOrderID; } |