Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 09:37:01 +0000



[Programming Help] - Multiple stops to Break Even ASCIL

View Count: 713

[2021-11-28 23:54:02]
JDCII2112 - Posts: 21
Hello, I am trying to code/replicate what happens when I enter a position and use the attached targets window settings. I have the position split into 2 separate stops. Both activate with the same Trigger Offset, 12 in the case below. However one has a BE Level offset of 6 and the other of 1. This works using the attached orders window.

However I am trying to use the following code and it will attach and move the 2 orders once the Trigger Offset is met, however it moves both stops to 6 instead of splitting them to 6 and 1.

Am I using the correct NewOrder.MoveToBreakEven.Type?

Below is my code:

{
s_SCNewOrder NewOrder;
NewOrder.OrderQuantity       = Position_Size.GetInt();
NewOrder.OrderType       = SCT_ORDERTYPE_MARKET;
NewOrder.TimeInForce       = SCT_TIF_GOOD_TILL_CANCELED;
    
//EXIT I
NewOrder.Stop1Offset           = Initial_Stop.GetInt()*sc.TickSize;
NewOrder.AttachedOrderStop1Type       = SCT_ORDERTYPE_STOP;
NewOrder.OCOGroup1Quantity         = Position_Size.GetInt()/2;
  
NewOrder.MoveToBreakEven.Type        =MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED;
NewOrder.MoveToBreakEven.TriggerOffsetInTicks    = 12;
NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks  = 1;
    
NewOrder.Stop2Offset           = Initial_Stop.GetInt()*sc.TickSize;
NewOrder.AttachedOrderStop2Type       = SCT_ORDERTYPE_STOP;
NewOrder.OCOGroup2Quantity         = Position_Size.GetInt()/2;
NewOrder.MoveToBreakEven.TriggerOffsetInTicks    = 12;
NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks  = 6;
    
sc.BuyEntry(NewOrder);
}    


Thanks for your help

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

Login

Login Page - Create Account