Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with breakeven

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

    #16
    Hello Mercader,

    Thank you for your response.

    I would like to clarify here on my last post.
    Is it okay that a reverse occurs before the position is closed by the Stop? Is this desired?

    If not you can add checks to the conditions to ensure the position is Flat before reentry:
    Code:
    // Condition set 1
    if (Position.MarketPosition == MarketPosition.Flat && CrossAbove(WMA(CortaEntradaLargo), WMA(LargaEntradaLargo), 1)
    && ADX(14)[0] > ValorADX)
    {
    EnterLong(DefaultQuantity, "Largo");
    }
    
    // Condition set 2
    if (Position.MarketPosition == MarketPosition.Flat && CrossBelow(WMA(CortaEntradaLargo), WMA(LargaEntradaLargo), 1)
    && ADX(14)[0] > 20)
    {
    EnterShort(DefaultQuantity, "Corto");
    }
    I look forward to your response.

    Comment


      #17
      Originally posted by NinjaTrader_PatrickH View Post
      Hello Mercader,

      Thank you for your response.

      I would like to clarify here on my last post.
      Is it okay that a reverse occurs before the position is closed by the Stop? Is this desired?

      Yes, a reverse occurs, but The strategie doesn't filled the stoploss order (that it's what i want). It filled the previous breakeven order

      If not you can add checks to the conditions to ensure the position is Flat before reentry:
      Code:
      // Condition set 1
      if (Position.MarketPosition == MarketPosition.Flat && CrossAbove(WMA(CortaEntradaLargo), WMA(LargaEntradaLargo), 1)
      && ADX(14)[0] > ValorADX)
      {
      EnterLong(DefaultQuantity, "Largo");
      }
      
      // Condition set 2
      if (Position.MarketPosition == MarketPosition.Flat && CrossBelow(WMA(CortaEntradaLargo), WMA(LargaEntradaLargo), 1)
      && ADX(14)[0] > 20)
      {
      EnterShort(DefaultQuantity, "Corto");
      }
      I look forward to your response.
      I dont know if I've explained correctly

      Comment


        #18
        Hello Mercader,

        Thank you for your response.
        Originally posted by Mercader View Post
        1.- It goes long by a cross moving average,
        2.- It reach the price for stop breakeven.
        3.- The strategie goes short by a cross moving average.
        4.- It goes long again by a cross moving average. (It never has been flat)
        5.- It doesn´t take stoploss because it´s blocked for stop breakeven (long), because condition for reset stoploss is to be flat.
        Is this occurring in backtesting? Will this recreate the MAE item or is this item un-related?

        Can you advise what instrument, period type and interval as well as the time frame this was tested on?

        I look forward to your response.

        Comment


          #19
          It´s occurring on backtesting and simulated real time.

          Instrument is FGBL 09-13 and time frame 60min. Backtest period is from 09-06 to 07-13.
          There are 6 trades wrong. It´s dificult to occur, but it changes the backtest result.
          You can see in the first messages in the thread.

          Comment


            #20
            Hello Mercader,

            Lets start by making sure that your Stop Loss is being set to the correct value. In Patrick's example code this will make sure that your strategy is Flat before entering in another direction so you do not get your Position reversed on you. This way it will reset your Stop Loss by your first check to see if the Market is Flat.

            Note that if you would like to keep the reverse logic inside of your Strategy you will have to reset the Stop Loss value another way. For example you may want to reset your Stop Loss inside of your Entry Condition so when NinjaTrader submits the order the Stop Loss will be set back to Ticks.
            JCNinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_JC View Post
              Hello Mercader,

              Lets start by making sure that your Stop Loss is being set to the correct value. In Patrick's example code this will make sure that your strategy is Flat before entering in another direction so you do not get your Position reversed on you. This way it will reset your Stop Loss by your first check to see if the Market is Flat.

              Note that if you would like to keep the reverse logic inside of your Strategy you will have to reset the Stop Loss value another way. For example you may want to reset your Stop Loss inside of your Entry Condition so when NinjaTrader submits the order the Stop Loss will be set back to Ticks.
              Thank you. Problem solved.
              I reset the stop at the condition for long trades like you said and now all is ok.

              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
              330 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
              549 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X