Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Single entry but two targets?

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

    Single entry but two targets?

    Hello,
    Is it possible to enter two contracts at the same price
    Code:
    EnterLong(2, "EnterLong2contracts");
    while setting individual Profit Target(and/or Stop Loss)?
    What I could come up with is to 'manually' check if the targets are met

    Code:
    protected override void OnBarUpdate(){
    	EnterLong(2, "EnterLong2contracts");
    
    	if (Position.Quantity == 2) 
    		if (Close[0] > target1) // target1 met, for the 1st contract
    			ExitLong(1, "exit1stContract","EnterLong2contracts");
    
    	if (Position.Quantity == 1) 
    		if (Close[0] > target2) // target2 met, for the 2nd contract
    			ExitLong(1, "exit2ndContract","EnterLong2contracts")
    }
    Is there a simpler, or more NT8 appropriate, way to do it?
    Thanks

    #2
    Originally posted by utilizator View Post
    Hello,
    Is it possible to enter two contracts at the same price
    Code:
    EnterLong(2, "EnterLong2contracts");
    while setting individual Profit Target(and/or Stop Loss)?
    What I could come up with is to 'manually' check if the targets are met

    Code:
    protected override void OnBarUpdate(){
        EnterLong(2, "EnterLong2contracts");
    
        if (Position.Quantity == 2) 
            if (Close[0] > target1) // target1 met, for the 1st contract
                ExitLong(1, "exit1stContract","EnterLong2contracts");
    
        if (Position.Quantity == 1) 
            if (Close[0] > target2) // target2 met, for the 2nd contract
                ExitLong(1, "exit2ndContract","EnterLong2contracts")
    }
    Is there a simpler, or more NT8 appropriate, way to do it?
    Thanks
    Try placing orders separately at the same time. each with its own target.
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      Thanks RJay, I tried that
      Code:
      EnterLong(1, "EnterLong1stContract");
      EnterLong(1, "EnterLong2ndContract");
      but they fill at 1 tick difference, not at the same price. Any other ideas? Thanks

      Comment


        #4
        Hello utilizer,

        When you enable the strategy, have you increased the "Entries per direction" parameter to allow you to enter in a long position more than once? I have attached a screenshot of these settings and provided a link to our publicly available documentation on NinjaScript strategy parameters.

        I would also recommend to enable TraceOrders in the strategy and to observe the order submissions in the NinjaScript output window. This will tell you the exact reason why an order did not submit.

        TraceOrders - https://ninjatrader.com/support/foru...ead.php?t=3627

        Strategy properties - https://ninjatrader.com/support/help...tegyProperties

        Please don't hesitate to write back if this does not resolve your inquiry.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks NinjaTrader_Jim

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ct, Today, 01:53 AM
          0 responses
          6 views
          0 likes
          Last Post ct
          by ct
           
          Started by SmartArtsStudio, Yesterday, 11:24 PM
          0 responses
          3 views
          0 likes
          Last Post SmartArtsStudio  
          Started by kenz987, Yesterday, 10:06 PM
          0 responses
          5 views
          0 likes
          Last Post kenz987
          by kenz987
           
          Started by AaronKoRn, Yesterday, 07:24 PM
          0 responses
          8 views
          0 likes
          Last Post AaronKoRn  
          Started by Aquatrade, 05-15-2021, 11:46 AM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X