Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss

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

    SetStopLoss

    I am trying to set my stop loss and have it update every tick not just at the close of the bar. I want the strategy to only calculate on the close of the bar but I would like to have the SetStopLoss react quicker than the close of the bar. In an ATMStrategy the stop is moved immediately when the event occurs but I cannot mange to accomplish this in my strategy.

    if (Position.MarketPosition == MarketPosition.Flat)
    {
    SetStopLoss("", CalculationMode.Ticks, 8, false);
    }

    // If a long position is open, allow for stop loss modification to breakeven
    else if (Position.MarketPosition == MarketPosition.Long)
    {
    // Once the price is greater than entry price + x ticks, set stop loss to breakeven
    if (Close[0] > Position.AvgPrice + 3 * TickSize)
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);
    }
    if (Close[0] > Position.AvgPrice + 8 * TickSize)
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice + 4 * TickSize);

    Is it possible to switch CalculateOnBarClose from true to false. ex: it is set to true unless (Position.MarketPosition != MarketPosition.Flat) and then switch it back to true when Flat?
    Last edited by thepcmd; 12-01-2007, 10:30 AM.

    #2
    I would prefer to use the ATMStrategy to place and managed my trades in my strategies but getting my accounts PnL to manage has been troublesome. I want to place a daily profit and stop level so if it reaches that level it will not take any additional trades. Is there any way to get my accounts realized PnL when using ATMStrategies?

    Comment


      #3
      In NT6.5 you can do this with some of the new methods. You can place your SetStopLoss logic inside the OnMarketData() method and that will update your stop loss on a tick by tick basis while leaving your OnBarUpdate() to run with CalculateOnBarClose as true.

      To get your accounts realized PnL when using ATM strategies you can use this. http://www.ninjatrader-support.com/H...rofitLoss.html
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      331 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      549 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      550 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X