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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    61 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    148 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    98 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X