Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Pending Order Cancelled

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

    #16
    Hi Brett, I tried two different options but none of them worked. Still "order pending" "order cancelled".

    1) private bool entrarlargo = false
    private bool entrarcorto = false

    and then my conditions and this:

    if (Close [0] > entrada) Entrarlargo= true;
    if (Entrarlargo == true)EnterLongLimit(entrada);
    else if (Close [0] < entrada)Entrarcorto = true;
    if (Entrarcorto == true)EnterShortLimit(entrada);

    So in this option I just deleted
    if (Position.MarketPosition==MarketPosition.Flat) Entrarlargo= false;
    if (Position.MarketPosition==MarketPosition.Flat) Entrarcorto= false;

    I thought this way I was calling EnterLongLimit/EnterShort every OnBarUpdate to keep it active.

    2) private bool entrarlargo = false
    private bool entrarcorto = false

    and then my conditions and this:

    if (Close [0] > entrada) Entrarlargo= true;
    if (Entrarlargo == true)EnterLongLimit(entrada);
    else if (Close [0] < entrada)Entrarcorto = true;
    if (Entrarcorto == true)EnterShortLimit(entrada);
    if (Position.MarketPosition==MarketPosition.Long) EntrarCorto= false;
    if (Position.MarketPosition==MarketPosition.Short) EntrarLargo= false;

    I again thought this way I was calling EnterLongLimit/EnterShort every OnBarUpdate to keep it active.

    But none of the options are good.

    Am I in the right direction?

    Thank you

    Comment


      #17
      Hello,

      Please try this:

      if (Close [0] > entrada) Entrarlargo= true;
      if (Entrarlargo == true)EnterLongLimit(entrada);


      Just to make sure it opens your positions as you expect, you should have it enter long not very many times and stay long for a long time is this correct?

      I look forward to assisting you further.
      BrettNinjaTrader Product Management

      Comment


        #18
        Hi Brett,

        You said: Please try this:

        if (Close [0] > entrada) Entrarlargo= true;
        if (Entrarlargo == true)EnterLongLimit(entrada);

        That's exactly what I already have. Have you seen the two options I tried in my previous post? Both of them have that.

        About the other question, my strategy open a lot of long and short positions and for a very little time, four or five ticks.

        Sincerely

        Comment


          #19
          Hello,

          I understand that, I wanted you to just use this. Delete the rest out please and use only what I quoted that you have.

          You issue is still your dont take the trade logic. Your simply not calling EnterLongLimit on every on bar update.

          Your other issue you have in your code is you are calling EnterShortLimit right after EnterLongLImit. Which then tried to reverse your position.

          else if (Close [0] < entrada)Entrarcorto = true;
          if (Entrarcorto == true)EnterShortLimit(entrada);

          This bar here will flip flop your position and is not good.

          Basically I want to get you just doing a long limit order once without cancellations to then be able to build from there.
          BrettNinjaTrader Product Management

          Comment


            #20
            Ok, I was just confused.

            I used only:

            if (Close [0] > entrada) EntrarLargo= true;
            if (EntrarLargo == true)EnterLongLimit(entrada);

            Same problem, "order pending" "order cancelled"

            Sincerely

            Comment


              #21
              Hello,

              Please send your full strategy code to me at support at ninjatrader dot com ATTN: Brett so I can run this on my side. Be sure to reference this forum post as the order should not cancel it its only this in the strategy.

              I look forward to assisting you further.
              BrettNinjaTrader Product Management

              Comment


                #22
                I have just emailed the full strategy to you.
                I wrote Brett in the "topic" of the email.

                Not sure what you mean by:
                "Be sure to reference this forum post as the order should not cancel it its only this in the strategy."

                The name of the attached file is "order pending order cancelled" so you can see the reference of this forum, I guess you meant that.

                Thank you

                Sincerely

                Comment


                  #23
                  I forgot to tell you that the original value of the variables Tp (Target Profit) and Sl (Stop loss) instead of 1, change them to bigger values like 6 or 7.

                  Thanks

                  Sincerely

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  75 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  146 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  79 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  54 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X