Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

about multi instrument trading

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

    about multi instrument trading

    Dear friends.
    I have create multi instrument strategy. And start back test, and I read report, but I can see only trades for 6E. What's wrong with this strategy?
    Code:
    protected override void Initialize()
            {
                CalculateOnBarClose = true;
                            Add("6E 12-11", PeriodType.Minute, 15);
                Add("6B 12-11", PeriodType.Minute, 15);
                Add("6C 12-11", PeriodType.Minute, 15);
                Add("6S 12-11", PeriodType.Minute, 15);
                Add("6J 12-11", PeriodType.Minute, 15);
          
            }
    if (CurrentBar > Bars.Count - 4) {
    
    
                sum=x1+x2+x3+x4+x5;
                }
                if (sum<10)
                {
                    EnterLong(0,1,"E");    
                    EnterLong(2,1,"B");
                    EnterLong(3,1,"C");
                    EnterLong(4,1,"S");
                    EnterLong(5,1,"J");
                }
                
                if (Position.GetProfitLoss(Close[0], PerformanceUnit.Points)>10)
                {
                    ExitLong();    
       
                }
    Attached Files

    #2
    I want to open position with triger described in previous post, and exit when total profit of all position will be more of some predefined value in ticks or in money. I try in my code to exit positions (I want to close all position at all instruments at the same time).

    Comment


      #3
      daglas, what do you have for your OnBarUpdate() section? I don't see it listed anywhere to enter/exit trades. How are you trying to enter the trades?

      You can separate out the different bar series updates:
      Code:
      OnBarUpdate()
      {
        if (BarsInProgress == 0)
        {
          // first series update
        }
        else if (BarInProgress == 1)
        {
          // second series update
        }
         ...
      }
      AustinNinjaTrader Customer Service

      Comment


        #4
        I use such code for opening and closing positions
        Code:
        protected override void OnBarUpdate()
                {
                    if (CurrentBar > Bars.Count - 4) {
        
                    sum=x1+x2+x3+x4+x5;
                    }
                    if (sum<10)
                    {
                        if (BarsInProgress == 0)
          {
        
                        EnterLong(0,1,"E");    
        }
        if (BarsInProgress == 2)
          {
        
                        EnterLong(2,1,"B");
        }
        if (BarsInProgress == 3)
          {
        
                        EnterLong(3,1,"C");
        }
        if (BarsInProgress == 4)
          {
        
                        EnterLong(4,1,"S");
        }
        if (BarsInProgress == 5)
          {
        
                        EnterLong(5,1,"J");
        }
                    }
                    
                    if (Position.GetProfitLoss(Close[0], PerformanceUnit.Points)>10)
                    {
                        ExitLong();    
         
                    }

        Comment


          #5
          Hi Daglas,

          What are your EntriesPerDirection and EntryHandling properties set?
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_RyanM View Post
            Hi Daglas,

            What are your EntriesPerDirection and EntryHandling properties set?
            I attach all strategy. All I want to close all positions when total profit of all positions will be more then 10 dollars.
            Attached Files

            Comment


              #7
              Your strategy does not contain these settings. Please take a look at the following help guide article on EntriesPerDirection and EntryHandling,




              These properties work closely together to determine if additional entries are accepted in the same direction (long or short). They can be set in code or when you run the strategy.
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              635 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              365 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              106 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
              571 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X