Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to program different profit targets for contracts purchased at the same time?

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

    How to program different profit targets for contracts purchased at the same time?

    Hello,
    I would like to submit an order for 2 ES contracts when something happens, e.g. price closes above 50 period SMA. I am fine programming it.

    But once the order is submitted I want to have different profit targets for both the contracts. Eg. for the first contracts I want to place profit target of 10 ticks whereas for the remaining one I want to place profit target of 20.

    Can someone please guide me how this can be done in NT?
    Thanks

    #2
    Hello pandyav,

    Thank you for your post.

    You will need to submit two separate orders with individual entrySignalNames that are then referenced in the SetProfitTarget() method.

    For example:
    Code:
    EnterLong(1, "mylong1");
    EnterLong(1, "mylong2");
    
    SetProfitTarget("mylong1", CalculationMode.Ticks, 10);
    SetProfitTarget("mylong2", CalculationMode.Ticks, 20);
    For information on SetProfitTarget please visit the following link: http://www.ninjatrader.com/support/h...ofittarget.htm

    Comment


      #3
      Thanks PatrickH,
      This was very helpful.

      Comment


        #4
        Hello There,
        So I created a part of the strategy and it compiles without any error messages. The challenge is it goes on and takes a trade on every single bar, what could be wrong?
        if (CurrentBar < 500)
        return;
        if ((CrossAbove(T3(14,1,0.7),VMA(high_vma_vol,high_vm a_period),1)))
        EnterLong(1,"Long 1");
        EnterLong(1,"Long 2");

        if ((CrossBelow(T3(14,1,0.7),VMA(high_vma_vol,high_vm a_period),1)))
        ExitLong(1,"Long 1 Exit","Long 1");
        ExitLong(1,"Long 2 Exit", "Long 2");

        Comment


          #5
          Hello pandyav,

          Thank you for your response.

          Please try setting EntriesPerDirection to 2 and then test the strategy once more.

          For information on EntriesPerDirection please visit the following link: http://www.ninjatrader.com/support/h...rdirection.htm

          Please let me know if I may be of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sidlercom80, 10-28-2023, 08:49 AM
          167 responses
          2,260 views
          0 likes
          Last Post jeronymite  
          Started by warreng86, 11-10-2020, 02:04 PM
          7 responses
          1,362 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          5 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          9 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Working...
          X