Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy builder -"on bar close" versus "on price change" or "on each tick"

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

    Strategy builder -"on bar close" versus "on price change" or "on each tick"

    I have coded a strategy in strategy builder. It now has the property of calculate "on bar close" and market entry at close of bar.

    I want to do a market order or limit order at the closing price of signal bar. I have attached a chart with what I want to do and what the strategy does now.
    Thank You.
    Attached Files

    #2
    Hello Karl Armstrong,

    Thanks for your post.

    Bar closures are signaled on the first tick of a new bar. When an order is submitted in a strategy on a bar closure, the data during the next bar would be used to fill that order.

    From your screen shot, we see your signal line and the line pointing to where you want to enter, and that you are already in a position. If your logic is checking if the position is flat before your next entry is submitted, your entry logic would not fire while the strategy is in a position. It looks like this is the case since we see the trail stop filling on the bar where you want to see your entry.

    Please note that if you are in a long position and call EnterShort, NinjaTrader will reverse the position and cancel the exit orders protecting the previous position. The same can be said for calling EnterLong when you are in a short position.

    I would suggest accomplishing your goal with a reversal. Create a separate condition that will handle when the strategy is long, your criteria for your short entry is made, and then EnterShort is called to close the long position and get you into a short position.

    Please see our Conditions and Actions examples for making Market Position checks in the Strategy Builder and for other tips on creating Conditions and Actions.

    Conditions examples —https://ninjatrader.com/support/help...on_builder.htm

    Actions examples — https://ninjatrader.com/support/help...us/actions.htm

    If you are instead trying to store the Close price of the signal bar so you can later submit an order to that price level, we suggest using a variable. You can create a variable of type double (holds fractional values) and when your signal bar is seen, you can assign the Close price of the signal bar to your variable. You can then use the variable later in your logic for the submission price of another order.

    Variables are created in the Inputs and Variables page of the Strategy Builder. You can check them with Conditions under User Variables and you can assign them in Actions under Misc > Set.

    We look forward to assisting.

    Comment


      #3
      Thank You.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      20 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      120 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X