Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
        BertrandNinjaTrader Customer Service

        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'.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            60 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            47 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X