Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto BE +1 Problem

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

    #31
    advs108,

    It may be possible to do what you want but let's hone in on your scenario first.

    Backtesting or real-time?
    Which orders are not behaving the way you expect? Entry orders or break-even orders?
    Ryan M.NinjaTrader Customer Service

    Comment


      #32
      Thanks Ryan,

      I am real time and doing the test with the simulated data feed.
      Be +1 is working perfectly fine.
      The problem is with the entry order. It is submitted too early. it is submitted at the open of the signal bar and 2 ticks above the high of the previous bar.
      What I want is to submit an order at close of the signal bar, 2 ticks above the signal bar. The signal bar is the one when the indicator gives us the 3rd green bar.
      You can see that very well on the picture attached to this post.

      Let me know if I am clear and if you want more informations.
      Thanks a lot !
      Attached Files

      Comment


        #33
        Hell adv108,

        Since you'd like to monitor for prices tick by tick for your Breakeven order, CalculateOnBarClose must be set to false.

        As Tim indicated you can use the principles of the reference sample to simulate CalculateOnBarClose = true behavior for other logic.

        They way this logic works in Engligh is:
        If the tick arriving is the first tick of a bar (open), check logic against the prior bar for possible entry conditions. It then submits the order if true.

        There's no way to submit the order on bar close because the condition requires evaluating the open of the next bar.

        One thing to keep in mind is that the open of the next bar and the closing of its prior bar are essentially the same event. The bar isn't "closed" until a new bar is formed.
        Ryan M.NinjaTrader Customer Service

        Comment


          #34
          Thank you very much Ryan.

          I understood that and I thought my code was doing that... I applied what is in the sample...
          how can I shift what is happening at the open of the signal bar to the open of the next bar ?

          I'm really stuck there, please have a look at my code and tell me if I did something wrong......

          Comment


            #35
            Ho !!!

            I shift all my boolean calculation one bar in the past and it seems to work !!!!!

            was that the way to proceed ?

            Comment


              #36
              Yes, that could certainly do it. Looked at your code and one of your conditions was evaluating the current bar[0], which would be a bar barely in progress when coupled with FirstTickOfBar.

              if (FirstTickOfBar && AO().AOValue[0] < AO().AOValue[1])
              {AOMinusOne = false;
              Print ("One is false");
              Print (CurrentBar);
              Print(Time[0]);
              }
              Ryan M.NinjaTrader Customer Service

              Comment


                #37
                yes, what I changed is :
                if (FirstTickOfBar && AO().AOValue[1] < AO().AOValue[2])
                {AOMinusOne = false;}

                before, it was :
                if (FirstTickOfBar && AO().AOValue[0] < AO().AOValue[1])
                {AOMinusOne = false;}

                Now that I understood and learned that, I'll try to do the same thing, but by calling an ATM....
                This will give me more possibilities in terms of moving stops and targets by hand, when in the trade !
                Thank you very much !!!!
                Last edited by advs108; 06-10-2010, 05:51 PM.

                Comment


                  #38
                  Hello There,

                  Just to let you know that with the help of the sample, I coded successfully the ATM call !
                  Thank you very much for all your help !

                  I'll now clean all my files and implement the ATM call in all my strategies.
                  After that, the next step, will be something being able to recognize divergence between indicator and price action

                  Syu then !

                  All the best and have a good week-end

                  Comment


                    #39
                    Problem with stop order, when calling the ATM

                    Hello,

                    I have a little problem with my orders, when I'm calling the ATM.
                    Limit order is working well. heres the code :

                    Code:
                    if (orderId.Length == 0 && atmStrategyId.Length == 0 
                    				
                    					&& (My conditions here )
                    				
                    				)
                    			{
                    				atmStrategyId = GetAtmStrategyUniqueId();
                    				orderId = GetAtmStrategyUniqueId();
                    				AtmStrategyCreate(Cbi.Action.Sell, OrderType.Limit, Low[0] - bufferentry * TickSize, 0, TimeInForce.Day, orderId, atmname, atmStrategyId);
                    			}
                    But, when I change the limit order to a stop order type, like this :

                    Code:
                    AtmStrategyCreate(Cbi.Action.Sell, OrderType.Stop, Low[0] - bufferentry * TickSize, 0, TimeInForce.Day, orderId, atmname, atmStrategyId);
                    The atm is not called anymore.
                    I checked the logs and the error is :

                    Stop price parameter can not be zero when submitting a stop order

                    How can I fix that ?

                    Thank you for your help.

                    Comment


                      #40
                      Hi advs108,

                      The proper syntax for this is...
                      AtmStrategyCreate(Action action, OrderType orderType, double limitPrice, double stopPrice, TimeInForce timeInForce, string orderId, string strategyTemplateName, string AtmStrategyId)

                      So it seems, you will need to rearrange your price, as you are explicitly entering a Stop value of zero.
                      TimNinjaTrader Customer Service

                      Comment


                        #41
                        Hummm... ?

                        I thought I was sending my order at this price :

                        Low[0] - bufferentry * TickSize

                        bufferentry is a variable, so I'm not sending my order at the low of the current candle minus a certain number of ticks ?

                        Comment


                          #42
                          Hi advs108,

                          The syntax is...

                          AtmStrategyCreate(Action action, OrderType orderType, double limitPrice, double stopPrice, ....

                          Previously, you were submitting a limit order, now, with a stop order, the price should be the fourth parameter in the sequence, not the third.
                          TimNinjaTrader Customer Service

                          Comment


                            #43
                            OH ! Right !
                            Sorry for being so dense...

                            it's like this :
                            AtmStrategyCreate(Cbi.Action.Sell, OrderType.Stop, 0, Low[0] - bufferentry * TickSize, TimeInForce.Day, orderId, atmname, atmStrategyId);

                            Thank you very much !

                            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
                            108 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