Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Second Breakeven

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

    Second Breakeven

    hello
    I would have added a second breakeven the first 5 + 1 and the second
    7 + 4 only when the market goes over +7 ticks in my favor and then
    goes back to +6, the breakeven "dances" between +1 and + 4 This is the
    code, am I probably missing something?
    thank you very much


    Massimiliano





    protected override void OnBarUpdate()
    {
    if (CurrentBar < BarsRequiredToTrade)
    return;
    // Resets the stop loss to the original value when all positions are closed
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    TriggerState = 0;
    SetStopLoss(CalculationMode.Ticks, StopLossTicks);
    }
    // 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+3 ticks, set stop loss
    to breakeven
    if (Close[0] > Position.AveragePrice + 3 * TickSize)

    {
    TriggerState=1;
    SetStopLoss(CalculationMode.Price, Position.AveragePrice +1*TickSize);
    }
    //
    // Once the price is greater than entry price+3 ticks, set stop loss
    to breakeven
    if (Close[0] > Position.AveragePrice + 7 * TickSize)
    {
    TriggerState= 2;
    SetStopLoss(CalculationMode.Price, Close[1] +4*TickSize);
    }

    #2
    Hello Massimiliano,

    This appears to be the same text in an email I have received.

    Are you creating multiple inquiries for the same question?

    While we are happy to assist on the forums or with you privately through email with our platformsupport [at] ninjatrader [dot] com address, we respectfully ask that you only create one inquiry. This can be privately in email or can be a public thread on the forum.

    If you would no longer like to communicate through email and you would like to communicate on the forums, please let us know so and we will converse solely through the forums.

    Creating both a forum thread and an email with platformsupport [at] ninjatrader [dot] com will create two separate tickets and may cause multiple technicians to start at the beginning of reviewing your inquiry, tying up resources with our platform support and delaying our ability to respond to all customers in a timely manner.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    132 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X