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 Not Calculating on Bar Close When Live?

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

    Strategy Not Calculating on Bar Close When Live?

    Hello,

    Please see the image attached. I have my strategy set up to calculate on bar close and am using Renko Bars (7/2). However, when I am live, it appears that the strategy is being calculated prior to the bar closing when a target (TP or SL) is hit. I am using the strategy builder's take profit and stop loss.

    The left hand side of the image is from when I applied my strategy at the end of the day to view what the output should have been vs the right hand side which shows the output from live trading today. For whatever reason, when the first trade filled at the take profit, the strategy immediately submitted a new order. Shouldn't the strategy wait until the bar is closed as I have it set up to only take one entry per side? My thought is that it should act in similar fashion to the left hand side. Unfortunately, this turned a very green day in theory to a red day in action. Any assistance is appreciated!

    #2
    Hello Hubernb1,

    Thanks for your post and welcome to the NinjaTrader forums!

    Can you clarify if you are using NinjaTrader7 or NinjaTrader8? The reason for asking is that you have posted in the NinjaTrader7 strategy forum and your chart display appaers more like NinjaTrader8. You also mention "Strategy Builder" which would be found in NinjaTrader8. No worries as we can and will move the thread if you are using NinjaTrader8.

    NinjaTrader Renko bars do not show a wick and only have a single brick size setting, what are the actual bars you are using?

    A stop-loss or profit target is a limit type of order and they will fill when the price hits and goes through them not when the bar closes.

    When looking at historical trades made on historical bars, these will be different because the historical bar only consists of the Open, High, Low, and Close[0] values of the bar and does not show all of the ticks that went into building the bar. To get a better idea of your strategy performance you can use the Playback connection with market replay data. In playback, the bars are built a tick at a time just like real-time.


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul,

      Thank you for your response. I apologize, this is one of my first posts. I am using NT8. My RenkoBars are TDU Renko Bars.

      When the previous bar closed and the next bar opened, that is when the limit order was filled, followed by a new buy limit. My question is around why the new buy limit order would have opened on the same bar that the previous trade closed? Shouldn't it have waited until the current bar closed to re-calculate and open the new position as it was in an active position (in the same direction, with the 1 order per direction active) when the previous bar closed (which is when it would have calculated whether or not to open a new position).

      Thanks!

      Comment


        #4
        Hello Hubernb1,

        Thanks for your reply.

        No worries and as you can see the thread is now in NinjaTrader8 Strategy Development.

        Regrettably, I have no knowledge of these TDU Renko bars so I cannot advise of their performance.

        Limit orders will only fill when price go through them. so a bar close would not be a trigger of this and my guess is that this is coincidental. I would suggest running your strategy on Playback with Market replay data and observe the performance there. If you find an anomaly, the great thing about playback is you can then repeat as needed as many times as needed to help clarify and debug.

        Even though you mention OnBarClose it does sound like your strategy may be running with either Calculate.OnPriceChange or Calculate.OnEachTick, when you apply your strategy please check before you click the enable checkbox what the calculate setting is for the strategy.

        When you look at historical trades (trades not made on live data) keep in mind that your strategy can only process these as if it was running with Calculate.OnBarClose.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X