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

Difference between Time Frame start and manual Strategy start

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

    Difference between Time Frame start and manual Strategy start

    Hello,

    On the Strategy Tab in the Control Center:

    I have a strategy that works as expected when not setting the TIme frame (that is start and stop at 12:00 AM) when defining a New Strategy and starting it manually at the desire time.

    However, when I define the strategy to start at a specific time (New Strategy dialog / Time Frame) I am getting some strange results from unexpected data streaming in when the strategy starts.

    Here is how I am set up...seems I am missing some type of filter....I only want to start processing on the first tick of a new bar, starting with the first new bar AFTER the strategy starts.

    But, I am getting a flood of bogus (?) data when the strategy starts at the specified Time Frame time . This does not happen when I start the strategy manually.

    Can someone please tell me how to filter that bogus data?



    //------------------------------------------------------------------------------------------------------------
    // Initialization
    //------------------------------------------------------------------------------------------------------------
    protected override void Initialize()
    {
    CalculateOnBarClose = false;
    }

    //------------------------------------------------------------------------------------------------------------
    // Called on each bar update event (incoming tick)
    //------------------------------------------------------------------------------------------------------------
    protected override void OnBarUpdate()
    {
    if (Historical)
    return;

    if (!FirstTickOfBar)
    return;

    Thanks

    #2
    Hello TurtleTrader,

    Thank you for your post.

    Please share the complete snippet that is producing unexpected results. Let us know how you are determining there is "bogus" data coming in.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      reply

      Hello,

      Please see the attachments.

      I've enclosed a skeleton strategy that will produce the results.

      This does not occur when I start the strategy manually with the Start button.

      It happens either with replay data or live demo zen feed data.

      It happens when the strategy is started via the New Strategy / Time Frame parameters.

      It looks like a bunch of historical data is getting through my filter on the first tick.

      Please advise, thanks....
      Attached Files

      Comment


        #4
        This is caused by your chart type and short session time.

        You're performing this test against range bars for 10 minutes a day.

        With this setup you're usually going to see a gap in prices between sessions. Every bar in the default range bar display type will need to be the same size from high to low. If there's a gap, then it's filled in with the range bars. OnBarUpdate() is run for all of these bars that are used to fill in the gap and that's why you see the loop counting up.

        Please see the attached screenshot which shows the same chart in range bar and minute. The minute bars make the gaps more apparent.

        You can look into a different range bar implementation at this link.
        Attached Files
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          reply

          OK, that makes sense...the problem is a session boundary and that Ninja creates synthetic data to create the first bar in the new session and is pushing it through the strategy?

          Also, the behavior of the strategy is normal when it is manually started with the Start button.

          Will look at the other range bar implementation.

          Thanks

          Comment


            #6
            reply

            With the Alternate Range bar defininition

            1) does it overlay the original Range bar definition
            2) if so, how can I restore the original

            Thank you

            Comment


              #7
              It does not replace the default range bars. It's an additional chart display called RangeAlt.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                reply

                thank you.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by PhillT, Today, 02:16 PM
                2 responses
                3 views
                0 likes
                Last Post PhillT
                by PhillT
                 
                Started by Kaledus, Today, 01:29 PM
                3 responses
                9 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by frankthearm, Yesterday, 09:08 AM
                14 responses
                47 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by gentlebenthebear, Today, 01:30 AM
                2 responses
                14 views
                0 likes
                Last Post gentlebenthebear  
                Started by PaulMohn, Today, 12:36 PM
                2 responses
                17 views
                0 likes
                Last Post PaulMohn  
                Working...
                X