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 Update Processing

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

    Strategy Update Processing

    How would I structure a Strategy that would issue Entry orders on a Bar close basis, and Issue Exits on Every Tick. The Strategy should still be usable for BackTesting. I tried the code below but it does not work for backtest.
    [line]
    CalculateOnBarClose = false;

    if(Bars.Complete==1)
    {
    // Entry orders
    }

    // Exit Orders


    #2
    imported post

    See the FirstTickOfBar property in the Help Guide. There is a catch -
    • Backtestresolution is only by bar not by tick so you will not be able to truly backtest this strategy
    • Since FirstTickOfBar is true on the first tick of a bar, you need to access the values from the prior bar to analyze the close of the prior bar to generate your signal, in backtest, this will throw things off since backtest only evaluates on bar close

    Ray
    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      Thanks,

      My hat is off to you Ray and the Ninja Team, for having thought through so many of these situations.

      Comment


        #4
        imported post

        Backtest resolution is only by bar not by tick so you will not be able to truly backtest this strategy
        Has this changed?

        When I use the Strategy Analyzer to backtest, under "Data series" it allows me to select Type of Year, Month, Week, Day Hour, Minute, Second, Volume, and Tick.

        So, if "Type" were selected as "Tick", would this provide a tick-by-tick backtest scenario?

        If not, what does it do when I select "Tick"?

        Thanks.

        KBJ

        Comment


          #5
          imported post

          Provides a tick based interval at a user defined compression level. IE 50 tick bar, 100 tick bar.
          RayNinjaTrader Customer Service

          Comment


            #6
            imported post

            I'm not sure what to think about a "user defined compression level". This doesn't answer my first two questions, and leaves me wanting to ask more questions to clarify what is meant "user defined compression level".

            So, here's my list of current confusions on this topic:

            1. Does "user defined compression level" mean that's how the bar widths are defined when charts are displayed?

            2. Does this also affect how often OnBarUpdate() is called on a backtest?

            3. Has the feature changed, so that tick-level backtest resolution is now available?

            4. If I set the backtest "Data series" type to "Tick" and value to 1, will this create NO "user defined compression"?

            5. And if so, will this then provide a tick-by-tick backtest scnario?

            Thanks.

            KBJ

            Comment


              #7
              imported post

              We are talking apples to oranges here.

              Tick by tick level backtesting is not possible. Backtesting is based on a bar which has OHLC information. Tick by tick level backtesting means that you can backtest on a 1 min bar but each historical tick that makes up that 1 min bar is used in the backtest vs the bar by itself.

              1. No. Minute, Tick, Second, Day etc... is an interval. Compression is the period value. So a 5-minute bar is has a compression value of 5. a 100 tick bar has a compression value of 100.

              2. No.

              3. No.

              4. You get a 1 tick bar to backtest on.

              5. You get a bar based backtest resolution however, since a 1 tick bar is the lowest common denominator for any bar, you in fact get a tick by tick backtest.

              Ray
              RayNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by adeelshahzad, Today, 03:54 AM
              5 responses
              31 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by stafe, 04-15-2024, 08:34 PM
              7 responses
              31 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by merzo, 06-25-2023, 02:19 AM
              10 responses
              823 views
              1 like
              Last Post NinjaTrader_ChristopherJ  
              Started by frankthearm, Today, 09:08 AM
              5 responses
              18 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              43 views
              0 likes
              Last Post jeronymite  
              Working...
              X