Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Errors closing positions

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

    Errors closing positions

    Hi, i am programming a simple strategy and Nt7.0.23 are having strange behaviors.
    I attached some screens capture where you can see it:






    The strategy code ist simple:

    Code:
    .
    .
    .
    
            protected override void OnBarUpdate()
            {
    
                mylong = "myconditionstolong";
                myshort= "myconditionstoshort";
                
                if (ellargo < Close[0]){ExitShort();EnterLong(DefaultQuantity, "");}
                if (elcorto > Close[0]){ExitLong();EnterShort(DefaultQuantity, "");}
                
                // Resets the stop loss to the original value when all positions are closed
                if (Position.MarketPosition == MarketPosition.Flat){
                    SetStopLoss(CalculationMode.Ticks, mistop);
                }
                
                // If a long position is open, allow for stop loss modification to breakeven
                else if (Position.MarketPosition == MarketPosition.Long){
                    if (Close[0] == Position.AvgPrice + 9 * TickSize){
                        SetStopLoss(CalculationMode.Price, Position.AvgPrice + 1 * TickSize);
                    }
                   if (Close[0] == Position.AvgPrice + 18 * TickSize){
                        SetStopLoss(CalculationMode.Price, Position.AvgPrice + 9 * TickSize);
                    } 
                    (etc ................)
    
                 }
    .
    .
    .
    .
    .

    #2
    marynja, please update to the latest version of NinjaTrader and see if the problem persists. We are on the second production release of NT7 (7.0.1000.2) at this point, so the error might've been fixed by now. You can update by going to Help -> Download Site.
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    651 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X