Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple entries with unique TP/SL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multiple entries with unique TP/SL

    Hello,

    Is possible in a strategy to enter in a trade multiple times (if condition is true) with different TP/SL generated by ATR?

    I mean, each time formation is formed, enter a trade, regardless number of current opened positions. TP and SL would be generated by ATR(4), TP - ATR4 and SL - ATR4, Each new trade would have different TP/SL.

    Currently in my strategy i use iorders but i dont really know how to program multiple entries and have several opened positions with each unique TP/SL generated by ATR.


    Code:
    EntriesPerDirection = 1000;
    EntryHandling = EntryHandling.AllEntries;
    
    if (High[1] > High[2] && High[1] > High[3] && High[1] > Hi}gh[4] && High[0] > High[1])
    
                
                && High[1] > upperValue_BB    
            ) 
        
                {
                    DrawArrowUp(CurrentBar.ToString(), false, 0, Low[0], Color.Lime); 
                   
                    entryOrderLong = EnterLongStop(0, false, 1, High[0] + 1 * TickSize,     "enter");
                }
    
      protected override void OnOrderUpdate(IOrder order)
            {
             
            if (entryOrderLong != null && entryOrderLong == order)
            {
                if (order.OrderState == OrderState.Filled)
                {
           
                    exitLimitLong = ExitLongLimit(0, true, 1, entryOrderLong.AvgFillPrice + ATR(value)[0], "TP", "enter");
                    exitStopLong = ExitLongStop(0, true, 1, entryOrderLong.AvgFillPrice - ATR(value)[0], "SL", "enter");    
    
                   
                }
            }
    Can i somehow program a code in OnOrderUpdate that would be called each time my condition is true and set TP/SL values according to current ATR?

    I would not like to program multiple blocks of code in OnOrderUpdate to set limit/stop orders.

    Thank you

    #2
    Hello Filip88,


    You could program a code in OnOrderUpdate that would be called each time my condition is true and create your TP/SL values according to current ATR.


    If you are relying on the OnOrderUpdate() method to trigger actions such as the submission of a stop loss order when your entry order is filled ALWAYS reference the properties on the IOrder object passed into the OnOrderUpdate() method.


    Please note, if you want to drive your strategy logic based on order fills you must use OnExecution() instead of OnOrderUpdate(). OnExecution() is always triggered after OnOrderUpdate(). There is internal strategy logic that is triggered after OnOrderUpdate() is called but before OnExecution() that can adversely affect your strategy if you are relying on tracking fills within OnOrderUpdate().

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    577 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X