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

Ninjascript Granularity

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

    Ninjascript Granularity

    Hi,

    I was able to implement the granularity by looking at a sample code provided by this awesome forum. The thing that has me wondering is the fact that I always enter a trade at the top of the hour or a minute past. Please allow me to explain:

    I'm doing a strategy that is implemented based on moving average crossover. I do have other things to filter out the bad signals. The chart time-frame that my strategy will be applied to is the hourly. But, I want to enter the trade as soon as possible; hence, I decided to use granularity, which has an inner bar object set to 1 minute to assist with me getting in the trade as soon as possible. Being a trader I know that the moving average can cross anytime during the one hour bar. The example code that I looked at does the same thing with all of the crossovers happening at the top of the bar or a minute past as well as my code. What can I do to fix this?

    Another problem that I'm having is with the stop loss. For some reason, I'm always getting out of the trade at the top of the hour. The pips for the stop-loss are correct, but I find it strange that this ALWAYS happens at the top of the hour.

    These two things, once I get them fix, should allow me to have a somewhat profitable strategy. I can't wait to start applying the strategy optimizer to get the exact moving averages that work the best.

    #2
    Hello BernWillChris,

    Thank you for writing in. The reference sample is designed to simulate intra-bar fills, not intra-bar calculations. If you wish for your strategy to calculate intrabar, you can remove the secondary data series and set CalculateOnBarClose = false; in your Initialize() method however this will only work in realtime. This will not work with historical data so it would not apply to backtesting. In NinjaTrader 8, with the advent of the Tick Replay feature, you will be able to backtest with CalculateOnBarClose = false; set.

    In NinjaTrader 7, if you need to be able to backtest and wish to have semi-simulated intrabar calculations, you will be limited to the close of the most recent bar of the smaller data series as the quickest the calculation can take place or the order can be placed. It sounds like you may already have your strategy to this point.

    If you would like to provide your strategy code I can better assist. Please attach your strategy code to an email to platformsupport[AT]ninjatrader[DOT]com (make sure to include this ticket number: #1357349) or feel free to post it here in the forums.

    Thank you in advance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Thanks for taking the time to thoroughly explain how it is done. I will consider getting Ninjatrader 8. I do have FXCM account and I believe that they only support NJ7. I might consider opening up a demo account with another broker so that I can have access to NJ8. Thanks again.

      Comment


        #4
        Hello BernWillChris,

        NinjaTrader 8 is currently in beta testing and has not yet been released to the public. NinjaTrader 8 supports FXCM. If you would like to be added to the list of beta testing applicants, please let me know.

        Thank you in advance.
        Michael M.NinjaTrader Quality Assurance

        Comment


          #5
          Omg!! Yes! Yes! Yes!

          Comment


            #6
            Hello,

            Please send an email to platform support @ ninjatrader.com and please include either a link to this post or ticket: 1357349

            I will need an email so that we can add you into the beta list.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks Jesse,

              The email has been sent.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DayTradingDEMON, Today, 09:28 AM
              2 responses
              15 views
              0 likes
              Last Post DayTradingDEMON  
              Started by Stanfillirenfro, Today, 07:23 AM
              6 responses
              22 views
              0 likes
              Last Post Stanfillirenfro  
              Started by navyguy06, Today, 09:28 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              8 responses
              32 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by helpwanted, Today, 03:06 AM
              2 responses
              22 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Working...
              X