Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry or Exit Not executing when conditions are met

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

    Entry or Exit Not executing when conditions are met

    Hello,

    I have a strategy set up with entry and exits built in. Im noticing a trend. 15 minute NQ chart.

    Condition is met at 0733 but im not entered into my trade until 0800. Im assuming that its because im on a 15 min chart and the condition is met in a ongoing bar then it has to wait until a new bar starts until it acutllly executes.

    Same with exiting the same trade. Conditon to exit is met at 1032 but not exited until 1100.

    How can I enter and exit on the close of the same bar were the condition was met? Not 2 bars later.

    First photo is entering trade. As you can see the condition is met (blue circle) but trade not entered until 2 bars later.
    Second photo is exiting trade. Same issue.

    Any help would be appreciated.

    #2
    Hello amigatlin,

    Thanks for your note.

    If you are using Calculate.OnBarClose when enabling your strategy, the strategy will only process logic and execute orders at the close of a bar.

    To have the strategy calculate logic and execute orders intrabar you could use Calculate.OnPriceChange or Calculate.OnEachTick.

    See this help guide page for more information about Calculate: https://ninjatrader.com/support/help.../calculate.htm

    Ultimately, debugging prints should be added to the script to fully understand how the strategy is processing logic and placing trades.

    To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.

    https://ninjatrader.com/support/foru...121#post791121​​

    Please let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Brandon,

      Thanks for the Reply. I tested out OnPriceChange and OnEachTick in it behaves the same way. I would like just to enter or exit the trade sooner than it is. Is there a way to force the trade on the currnent bar or intrabar?

      Comment


        #4
        Hello, thanks for the follow up. Please also make sure to enable Tick Replay if you are looking at historical trades (by default, historical trades all calculate OnBarClose)

        Comment


          #5
          NinjaTrader_ChrisL Thanks for the help. I was able to work things out.

          Comment


            #6
            Originally posted by amigatlin View Post
            NinjaTrader_ChrisL Thanks for the help. I was able to work things out.
            How did u fix this? I am having the same issue

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            53 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X