Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Executing the order on the same Tick

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

    Executing the order on the same Tick

    Hello,

    I am trying to place a long order when a condition is satisfied on a tick. I don't want the order placed on the next tick but instantly on the same tick. Is that possible? My strategy requires the order to be place before it moves to the next tick, otherwise the strategy fails.

    Thanks

    #2
    Hello MyFirstMillion,

    Thank you for writing in.

    You will want to set the property CalculateOnBarClose equal to false for your strategy to evaluate the condition and execute the moment it becomes true, rather than waiting for the bar to close. You can set this within the strategy (instructions below), or when applying the strategy to the chart/strategies tab via setting CalculateOnBarClose=False (see attachment).

    I have provided a link CalculateOnBarClose in our Helpguide;



    Example:

    Code:
    protected override void Initialize()
            {
                CalculateOnBarClose = false;
            }
    Please let us know if we may be of further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply. I have the setting set to false. But it is still placing trades on the next tick. Maybe it is because of split second execution is required. How do I place an stop order of current price + 7 points? The strategy wizard does not give me the option to set the offset from current price.

      Comment


        #4
        What kind of chart are you running?

        Comment


          #5
          I am running a backtest on GBPUSD currency

          Comment


            #6
            Originally posted by MyFirstMillion View Post
            But it is still placing trades on the next tick. Maybe it is because of split second execution is required.
            Isn't is possible that price has simply moved?

            Your strategy sees 1 or more ticks come in at a certain price, the strategy does your calculation magic using those ticks and decides to enter a trade, but by the time your order is executed the price has moved.

            Unless you use a limit order, isn't what you see happening entirely within the realm of normal and expected market behavior?

            Comment


              #7
              Yes, I do believe that is what is happening. However, The orders are not being placed at the limit I set but at the next open tick instead.

              Comment


                #8
                Originally posted by MyFirstMillion View Post
                Yes, I do believe that is what is happening. However, The orders are not being placed at the limit I set but at the next open tick instead.
                Post your entry order.

                Comment


                  #9
                  Originally posted by MyFirstMillion View Post
                  Yes, I do believe that is what is happening. However, The orders are not being placed at the limit I set but at the next open tick instead.
                  Ah, so you are using limit orders ...

                  Define "placed".

                  Is your actual entry FilledPrice the same as, better than, or worse than the LimitPrice of your entry order?

                  Can you provide an example?

                  Comment


                    #10
                    Originally posted by MyFirstMillion View Post
                    I am running a backtest on GBPUSD currency
                    Timeframe?

                    Comment


                      #11
                      Hello MyFirstMillion,

                      Regarding submitting an order on the current tick, this would not be possible. Your strategy analyzes a condition, when it becomes true it submits an order, which at the soonest could be on the next tick.

                      Regarding stop entry order. It would be possible to submit a stop market order 7 ticks above the current price using the strategy wizard.

                      Under Do the Following, you would select Order Management>Enter Long Position by a stop order. For the stop price you’ll click in the empty box “…”. You’ll then click “Price Data”>Close and for the offset set it to 7 and Offset Type to ticks. (See Screen shot)

                      I have attached a strategy which I built in the wizard. To get this strategy to correctly operate you should unlock the code and swap,

                      Code:
                      EnterLongStop(DefaultQuantity, Close[0] + 7 * TickSize, "BuyLong");
                      With,

                      Code:
                      EnterLongStop(0, true, DefaultQuantity, Close[0] + 7 * TickSize, "BuyLong");
                      Which will submit a GTC EnterLongStop order.

                      And Add the following on the first line in OnBarUpdate(),

                      Code:
                      	if(Historical) return;
                      Please let us know if you need further assistance.
                      Attached Files
                      Alan P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by trilliantrader, 04-18-2024, 08:16 AM
                      5 responses
                      22 views
                      0 likes
                      Last Post trilliantrader  
                      Started by Davidtowleii, Today, 12:15 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post Davidtowleii  
                      Started by guillembm, Yesterday, 11:25 AM
                      2 responses
                      9 views
                      0 likes
                      Last Post guillembm  
                      Started by junkone, 04-21-2024, 07:17 AM
                      9 responses
                      68 views
                      0 likes
                      Last Post jeronymite  
                      Started by mgco4you, Yesterday, 09:46 PM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Working...
                      X