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

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.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thank You.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      53 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      33 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      5 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      6 views
      0 likes
      Last Post cre8able  
      Working...
      X