Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AT add trades by itself and overfill

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

    AT add trades by itself and overfill

    Hi

    Here is my strategy:
    protected override void Initialize()
    {
    SetProfitTarget( CalculationMode.Ticks, profitTarget );
    SetStopLoss( CalculationMode.Ticks, loseTarget , true);
    CalculateOnBarClose = true;
    }
    protected override void OnBarUpdate()
    {
    if(condition1 && condition2){ EnterLong();}

    if(condition3){ ExitLong(); }

    if(condition3 && condition2){ EnterShort();}

    if(condition1){ ExitShort(); }
    }

    when condition1 && condition2 is true, I will have EnterLong and ExitShort at the same time. And when condition3 && condition2 is true, I will have EnterShort and ExitLong orders at the same time.

    In the above situation, There should be only 2 orders filled(1 exit and 1 entry), my AT works well in history data.

    Here is the problem, in real-time, it will have 3 orders filled instead of 2. There are 2 BuyToCover orders(should be 1), I don't know why, but the it only happen at real-time.

    If I let the AT keep running it will add 6 additional entries after 5 trades. and get the overfill msg popup sometimes.

    #2
    Hello silverfall,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    I will continue to work with you via e-mail and update this thread when we have additional information.

    Comment


      #3
      Hello,

      Thank you for your patience.

      Please comment out the SetProfitTarget and SetStopLoss lines in your code and then test the strategy again. The Close is the profit target being moved to close the position as the Enter method is called, but we also have the Exit method being called as well so the order doubles up.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      2 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X