Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 Positions Long?

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

    2 Positions Long?

    Hello.

    I would like to code a strategy with two positions in one direction with two different conditions.

    protected override void Initialize ()
    {
    EntriesPerDirection = 2;
    EntryHandling = Entryhandling.AllEntries;
    CalculateOnBarClose = true;
    }

    protected override void OnBarUpdate ()

    {
    if (Position.MarketPosition == MarketPosition.Flat && Condition1)
    {
    EnterLong(DefaultQuantity, "Long1";
    }
    if (Position.MarketPosition == MarketPosition.Long && Condition2)
    {
    EnterLong(DefaultQuantity, "Long2";
    }

    If (Condition Exit)
    {
    ExitLong("","");
    }


    But it is not working. I don´t get an execution for Long2?

    Thank you.
    Last edited by Ironman9973; 12-09-2012, 11:01 AM.

    #2
    Hello,

    Can you verify the EnterLong("Long2") is being reached with a Print() statement to the Output Window?

    If it is, could you provide me with the source file or simplified version that replicates this issue so that I may test on my end.
    Located in (MY)Documents\NinjaTrader 7\bin\Custom\Strategy

    I look forward to assisting you further.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Long2 is being reached. I checked that with a BackColorAll = Color.Red; But I don´t get an execution for the order. How can I send you the file?

      Thanks.

      Comment


        #4
        Ironman9973, same with the Entry Handling set to Unique Entries here? To see the reason for the potentially ignored order, please run this script with TraceOrders = true in Initialize() and then check the Output window - http://www.ninjatrader.com/support/f...ead.php?t=3627

        Comment


          #5
          Wizard is creating an auto strategy with two possible entries. Just like described here, it will only execute on one of the strategies. It will not allow both entries. Any ideas?

          Comment


            #6
            JMont, it would be important to check with which EntryHandling settings the script is applied - http://www.ninjatrader.com/support/h...=EntryHandling

            If you have two uniquely named entries, please try with the script set to 'UniqueEntries'.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X