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 pechtri, 06-22-2023, 02:31 AM
      9 responses
      122 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by frankthearm, 04-18-2024, 09:08 AM
      16 responses
      66 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by habeebft, Today, 01:18 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by benmarkal, Today, 12:52 PM
      2 responses
      13 views
      0 likes
      Last Post benmarkal  
      Started by f.saeidi, Today, 01:38 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X