Support Board
Date/Time: Wed, 12 Feb 2025 07:18:34 +0000
[Programming Help] - Trading Study (IF condition doesn't work for Target)
View Count: 414
[2020-10-14 06:52:32] |
User164131 - Posts: 19 |
Hi, I am creating my own study based on trading examples from Sierra. With this code, I send the "buy_entry" order with stop and target. In my study I have two inputs to turn ON/OFF the target and breakeven. The IF condition for Breakeven works fine. The problem is — target child order always created no matter what setting is set in "Input_UseTarget" YES or NO. It looks like every time Input_UseTarget.GetInt() returns True. How can it be? P.S. I have sc.UseGUIAttachedOrderSetting = false; sc.SupportAttachedOrdersForTrading = false; Here is the part of my code: s_SCNewOrder NewOrder; NewOrder.OrderQuantity = Input_PositionSize.GetInt(); NewOrder.OrderType = SCT_ORDERTYPE_LIMIT; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; NewOrder.Price1 = here is my entering price; if (Input_UseTarget.GetInt()) //HERE IS THE PROBLEM NewOrder.Target1Offset = Input_TargetOffset.GetInt() * sc.TickSize; NewOrder.Stop1Offset = Input_StopOffset.GetInt() * sc.TickSize; NewOrder.OCOGroup1Quantity = 1; if (Input_UseBreakEven.GetInt()) { NewOrder.MoveToBreakEven.Type=MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED; NewOrder.MoveToBreakEven.TriggerOffsetInTicks= Input_BreakEvenTriggerOffsetInTicks.GetInt(); NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks= Input_BreakEvenOffsetInTicks.GetInt(); } int Result = (int)sc.BuyEntry(NewOrder, BarIndex); Date Time Of Last Edit: 2020-10-14 06:53:31
|
To post a message in this thread, you need to log in with your Sierra Chart account: