Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Take action on incoming tick

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

    Take action on incoming tick

    What command can I use to move my stop loss to breakeven once price profits 4 ticks? I have the logic included below, but I do not want to wait for bar to close before my stop loss gets modified. I want stop loss to move to break even as soon as price touches 4 tick profit (rather than wait for bar to close). Is there a way to do this?

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

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


    }

    #2
    Hello,

    Do you have CalculateOnBarClose set to false in your initialization?
    DenNinjaTrader Customer Service

    Comment


      #3
      I can try that. There are some parts of the code that I want calculated only upon bar closing, except for this part. Is there way to do that. An example is initiating a trade only once bar closes, but moving my stop loss to breakeven once 4 tick profit is touched.

      Comment


        #4
        Hello,

        Then I would use FirstTickOfBar to trigger these 'on bar close' actions:
        DenNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        646 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        367 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X