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 Rapine Heihei, Today, 08:19 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Rapine Heihei, Today, 08:25 PM
            0 responses
            6 views
            0 likes
            Last Post Rapine Heihei  
            Started by f.saeidi, Today, 08:01 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Rapine Heihei, Today, 07:51 PM
            0 responses
            8 views
            0 likes
            Last Post Rapine Heihei  
            Started by frslvr, 04-11-2024, 07:26 AM
            5 responses
            98 views
            1 like
            Last Post caryc123  
            Working...
            X