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.

      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.

          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.

              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 judysamnt7, 03-13-2023, 09:11 AM
                  4 responses
                  59 views
                  0 likes
                  Last Post DynamicTest  
                  Started by ScottWalsh, Today, 06:52 PM
                  4 responses
                  36 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by olisav57, Today, 07:39 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post olisav57  
                  Started by trilliantrader, Today, 03:01 PM
                  2 responses
                  21 views
                  0 likes
                  Last Post helpwanted  
                  Started by cre8able, Today, 07:24 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X