Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Points of Entry and Scale w Managed Order Handling

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

    Multiple Points of Entry and Scale w Managed Order Handling

    I am trying to understand if I am about to reach a dead end or I can proceed on this direction with Managed Order Handling
    Basically I want to be able to have two completely separate positions within the same strategy, same contract, have brackets, and be able to scale in and out each of them.
    Would it work? would setStopLoss&Target adapt to the change in contracts quantity?
    Is there a fundamental error in this code that you may notice or the approach basically correct.
    Thank you!.
    G

    Below is the basic structure of the would be code:
    Assuming a code for Long Entry Only.
    I am thinking to create a strategy based on this structure:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    EntriesPerDirection = 2;
    EntryHandling = EntryHandling.UniqueEntries; // Hope I am correct on this one
    }

    OnOrderUpdate()
    {
    SetStopLoss("trade1", CalculationMode.Ticks, (stop1 * tickSize_), false ) ;
    SetStopLoss("trade2", CalculationMode.Ticks, (stop2 * tickSize_), false ) ;;

    SetProfitTarget("trade1", CalculationMode.Ticks, (target1 * tickSize_));
    SetProfitTarget("trade2", CalculationMode.Ticks, (target2 * tickSize_));

    If (condition1_for_trade1) EnterLong(1, "trade1") ;
    If (condition2_for_trade1) EnterLong(1, "trade1") ;

    ​If (condition1_for_trade2) EnterLong(1, "trade2") ;
    If (condition2_for_trade2) EnterLong(1, "trade2") ;

    ​If (condition3_for_trade1) Exit(1, "trade2") ;
    If (condition3_for_trade2) Exit(1, "trade2") ;

    If (condition4_for_trade1) ExitLong("", "trade2") ;
    If (condition4_for_trade2) ExitLong("", "trade2") ;
    }
    ​​

    #2
    Hello giogio1,

    You can have separate entries, and have exits that exit the specific entry by using the from entry signal of the entry signal name.
    Each quantity you want to scale out should be a unique entry order with a unique signal name.

    Below is a link to an example of scaling out of a position.


    However, a strategy cannot have multiple positions.
    An account can only have 1 position (either long or short with the quantity of all orders that contributed to the position) per instrument. A strategy also can only have 1 position per instrument.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X