Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter and exit too far from the crossover

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

    Enter and exit too far from the crossover

    How can I enter and exit closer to the crossover, please see image. I've tried "on bar close", "on each tick" and "on price change." and they are all doing the same.
    Attached Files

    #2
    Hello Mathias79,

    Thanks for your post.

    If you would like to have an action such as placing an order or drawing an object on the chart right when the crossabove/crossbelow condition occurs, you could set your script to Calculate.OnPriceChange and set the lookback period property to 0 when calling CrossAbove()/CrossBelow() in the script. Then, call your entry order within the condition.

    By doing so, this will check if the crossabove/crossbelow condition occurs on the current bar and calls your Entry order method.

    See the help guide documentation below for more information.

    CrossAbove(): https://ninjatrader.com/support/help...crossabove.htm
    CrossBelow(): https://ninjatrader.com/support/help...crossbelow.htm
    Calculate: https://ninjatrader.com/support/help.../calculate.htm
    <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
      How would I do that in the strategy builder?

      Comment


        #4
        Hello Mathias79,

        Thanks for your notes.

        You could set Calculate mode to OnPriceChange on the 'Default Properties' screen of the Strategy Builder.

        Then, in the 'Conditions and Actions' screen of the Strategy Builder you could create a CrossAbove/CrossBelow condition and set the 'Lookback period' property to 1.

        See the 'How to create a crossover condition' section of this help guide page: https://ninjatrader.com/support/help...on_builder.htm
        Last edited by NinjaTrader_BrandonH; 10-17-2023, 08:24 AM.
        <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


          #5
          I've done that, I've entered "0" in the look back period under "Cross Below" like it shows in your image but after I select OK, it changes back to 1. please see attached image
          Attached Files

          Comment


            #6
            Hell Mathias79,

            Thanks for your notes.

            Setting the Lookback Period setting to 1 for a CrossAbove/CrossBelow condition would be correct and I edited my previous post to reflect this.

            When using Calculate.OnPriceChange and CrossAbove/CrossBelow with a Lookback Period of 1 would allow the strategy to do an action once the crossover occurs.

            I have attached a simple sample strategy created using the Strategy Builder demonstrating this.

            Here is a demonstration video showing the strategy submitting an order when the crossover condition occurs: https://brandonh-ninjatrader.tinytak...OV8yMjI0NjQ5NA
            Attached Files
            Last edited by NinjaTrader_BrandonH; 10-17-2023, 08:23 AM.
            <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


              #7
              Question for you... you posted this link in another post, it is related to something I'm researching. The link it's taking me to "page not found"
              Do you have the correct link for this?

              SampleEnterOnceExitEveryTick -https://ninjatrader.com/support/help...either_cal.htm

              Comment


                #8
                Hello Mathias79,

                Thanks for your notes.

                I have linked the reference sample below for you to view. Please let me know if this link does not lead to the help guide page.

                SampleEnterOnceExitEveryTick: https://ninjatrader.com/support/help...either_cal.htm

                That said, you could find the reference sample in the help guide by running a search in the help guide for "SampleEnterOnceExitEveryTick".

                <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

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                563 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                329 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                547 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X