• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder

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

    Strategy Builder

    Hello all,

    Jus a few basic questions about usage.

    1.....I can drag and drop individual sets to reorder but when I save and exit a strategy then return later they have automatically reordered to the prior order. Can this be changed.
    2.....If I use the X and delete a set same sort of thing happens when I save and exit and then return later the deleted set has returned. Why?
    3.....the only way to delete an unwanted set is to individually remove each line at this point, reference item 2. The blank set then remains.
    4.....I have found that the (ATR and DEMA) indicators will not compile. I'll check more as time permits. Any reason for this?

    Are there any instructional videos on how to add a second data series. I'm trying to create an exit on close with a more granular timeframe?

    Thanks,

    GuppyDRV

    #2
    Hello GuppyDRV, and thank you for your questions.

    To your first three questions,
    Could you provide a screen shot of the screen you are referring to?
    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
    Click here for instructions
    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
    Click here for detailed instruction



    To your last question, these compile for me. Could you right click on the errors section at the bottom of your NinjaScript editor, and in your grid options, export your compile errors to a grid file, and attach this to a reply?


    I am including a video where I demonstrate this, and where I demonstrate creating a two data series strategy. The strategy is attached as well.


    http://www.screencast.com/t/EgqHBpn2
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Jessica,

      Thanks for the help. I'll try and get the error for you. I think I may have used the wrong term, when I select say the DEMA and then at the end of the Strategy Builder Wizard select Finish it tells me unable. If I then go back and change the DEMA to say a SMA with no other changes it works just fine. I have found that both the DEMA and the ATR indicators have this problem.

      Thanks for the script of the multi data series. It is helpful. The video you mentioned was not attached where can I find this.

      Happy Holidays,

      GuppyDRV

      Comment


        #4
        I am glad the attached script helped. Here is a link to the video I prepared again.

        http://www.screencast.com/t/EgqHBpn2

        Thank you again for this information. I look forward to assisting further.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Jessica,

          I'm just trying to get an understanding of the second data series function in the strategy builder. I have added a 1 tick data series in that section and have some questions regarding the results and what is happening.

          The attached screen shot shows a period of the day and several trades. The one I have labeled 1 shows an exit and an entry on the bar that closed at 11:30 AM. The exit is at 2169.75 which is .25 above open (I should say that I have 4 ticks of slip set) and the entry for the long happened at 11:25:08 (label 2).

          So..... I can see the exit logic has happened on the prior bar close (On Bar Close) which executes on the open of the new bar. I have read the Fill Logic section of the manual but am not exactly sure what is happening. Is the open price not the open price? Should it not be an Exit at 2169.50 (then slip applied to that)? With the second data series would the exit also be a more granular number?

          The entry price for the long at 2164.25? This price has never happened within that bar so where has the fill logic come up with that price? How is the 1 tick second data series effecting this price?

          If I'm dong this wrong how can I add a second data series to create a more granular picture for fills? I'm unable to find any tutorials or video's on this subject.

          One last question, I have a trade time in the logic of the wizard that starts trading at 8:30 Am. This works great with only one data series but when I add the second data series the strategy starts trading just after 6:30 AM which is when my session template starts it's day. With the one tick resolution it was like 6:30:04 so why is the time limiter in the strategy not working when the second data series was added.

          I know hard coding is an option but I would like to do this in the Strategy Builder if possible. If not possible can you detail how the additional data series in the builder would be used as well as the custom series(What would I use this for). There really is not much documentation that I can find on how this works.

          Thanks for your help.

          GuppyDRV
          Attached Files

          Comment


            #6
            We are always happy to help.

            While this is likely not an issue, one thing I would like to recommend as a debugging step every time you are reviewing prices and slippage is to ensure your computer's clock is in sync with a time server's clock.
            You can sync your PC clock by double clicking on the clock in the lower right corner of your desktop. Press 'Change time zone...' Set the Time zone and press 'OK'. Once you have done that, click on Internet Time tab set the server to time.nist.gov and then click Update. Your PC clock should now be updated.

            This said, remembering the adage "buy low, sell high", exiting a short order is entering an order on the long side of the market, and so the price 2164.25 does seem to be at least an allowed limit price, as it is in your favor compared to any limit price. Beyond this I do not have enough information to say why that was the execution price for that order. At a guess it could be that you had an order away from the currently traded price that was filled then. If you could provide a stripped-down copy of your strategy to platformsupport[at]ninjatrader[dot]com referencing 1630499 and Attn:NinjaTrader_JessicaP, with a screen shot of your backtest settings, we will be able to review this more carefully.

            To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
            Click here for instructions
            Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
            Click here for detailed instruction


            Generally with respect to trading on more granular data series, while you can add extra time series through the strategy builder, the overload for the entry methods that allow you to enter on different series are unavailable. I am referring to this,

            Originally posted by http://ninjatrader.com/support/helpGuides/nt8/en-us/enterlong.htm
            //The following method variation is for experienced programmers who fully understand Advanced Order Handling concepts:
            EnterLong(int barsInProgressIndex, int quantity, string signalName)
            As the documentation on that page suggests, more detailed information regarding placing orders on other time series can be found on this page,

            http://ninjatrader.com/support/helpG...r_handling.htm

            You also do not have the ability to conditionally process through strategy builder on different BarsInProgress numbers. BarsInProgress is an integer that's equal to 0 on your primary series, and the index of the currently processed data series otherwise, with the first data series you add taking on index 1 and additional data series taking on 2, 3, 4...

            With this in mind, I have submitted a feature request to the product management team for the following feature :
            This user would like to be able to access BarsInProgress in the condition builder, and the barsInProgressIndex overload for entry orders in the Actions section, of the Strategy Builder
            I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.

            Please let us know if there are any other ways we can help.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Jessica,

              Thanks for the reply but we are not communicating. The following link is to the section in the NT8 help guide regarding understanding order fill resolution.

              http://ninjatrader.com/support/helpG...r_handling.htm

              I have followed these steps and things never seem to work as advertised. What am I missing? My strategy only uses market orders and is set to calculate on bar close. These same issues can be duplicated using the pre-installed simple moving average cross over. With this in mind what is the purpose of these functions. I'm trying to create a more granular testing environment such that the results more accurately mirror actual trading.
              1. Can this be done in the Strategy Builder?
              2. If I set the resolution to "Fast" in the strategy builder what results should I expect?
              3. If I add a second data series in the Strategy Builder (If I'm using a primary 5 minute bar on my chart and set a 1 minute bar in the Builder with no other changes to the Strategy) what results should I expect?
              4. If I have set the resolution to fast in the Strategy Builder what effect does the resolution drop down choice in the optimizer screen have?
              5. Should I only be using the resolution drop down in the optimizer window and not changing anything in the Strategy Builder?
              If these questions still are not able to provide for an answer can you please detail how someone would create this more granular method described in the provided link.

              Thanks for the help.

              GuppyDRV

              PS: I need to also say that I'm using a basic strategy to figure these ideas out. No stop loss, no profit targets, only market orders with Calculate on Bar Close set to True. My assumption is that even with a more granular time my trades should still execute on the open price of the new bar. It's not until I introduce a target, stop loss, market order, intra bar fill (as in not on bar close) etc.... that the higher fill resolution would impact performance. Please correct me if I'm misunderstanding the theory.
              Last edited by GuppyDRV; 01-05-2017, 02:28 PM.

              Comment


                #8
                Thank you for the additional details, I will try to clear up the reply I sent.

                1. Can this be done in the Strategy Builder?
                No. This is why I put in the feature request I did. You need access to some things that are currently only available in code.



                2. If I set the resolution to "Fast" in the strategy builder what results should I expect?
                In order to discuss fast fill resolution, it is important to understand high fill resolution. The documentation for this is here.

                http://ninjatrader.com/support/helpG...ical_fill_.htm

                Briefly,

                • Fast fill resolution will rely only on OHLC data for your primary bars
                • High fill resolution would allow you to add a secondary series to process on
                  • But in order to take advantage of this feature, you would have to set up your strategy as a multi-time frame strategy (this documented here), which is currently impossible through the strategy analyzer.



                3. If I add a second data series in the Strategy Builder (If I'm using a primary 5 minute bar on my chart and set a 1 minute bar in the Builder with no other changes to the Strategy) what results should I expect?
                This is currently useful only for generating template NinjaScript code. Outside the strategy analyzer, you can set up your strategy as a multi-timeframe or multi-instrument strategy building on this template code.

                4. If I have set the resolution to fast in the Strategy Builder what effect does the resolution drop down choice in the optimizer screen have?
                For reasons already stated, this will have no effect on strategies you create through the strategy builder. On a multi-timeframe or multi-instrument strategy high fill resolution would allow you access to other data series.

                5. Should I only be using the resolution drop down in the optimizer window and not changing anything in the Strategy Builder?
                For reasons already stated, neither will have any effect.

                PS: I need to also say that I'm using a basic strategy to figure these ideas out. No stop loss, no profit targets, only market orders with Calculate on Bar Close set to True. My assumption is that even with a more granular time my trades should still execute on the open price of the new bar. It's not until I introduce a target, stop loss, market order, intra bar fill (as in not on bar close) etc.... that the higher fill resolution would impact performance. Please correct me if I'm misunderstanding the theory.
                Your understanding is correct; this is simply not something that is as of yet supported through the strategy builder.

                I will paste an example where a more granular strategy is created through code from the help guide. I will also boldface the lines that are inaccessible from the Strategy Builder.

                Code:
                private Order entryOrder = null;
                
                 
                
                protected override void OnStateChange()
                {
                  if (State == State.Configure)
                  {
                      AddDataSeries(BarsPeriodType.Tick, 1);
                  }
                }
                
                 
                protected override void OnBarUpdate()
                {
                    // Check if the main data series triggered an bar update event
                    if (BarsInProgress == 0)
                    {
                        // Submit an order on the more granular series in the context of our main bar
                        if (entryOrder == null)
                              EnterLongLimit(1, true, 1, Lows[1][0], "GranularEntry");
                    }
                }
                Last edited by NinjaTrader_JessicaP; 01-05-2017, 02:38 PM.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Jessica,

                  Thanks......I have gotten this working! What purpose does the EntryOrder == null provide. Is this kind of like checking for a flat market. Any references would be great. Additionally, I would like to use the BarsArray 1 for a more granular exit at the end of day as well. Do I need to do anything different with this.

                  This line of code was my sticking point but got if working. Do I have to do something else with this section of code to get my exits timed to the secondary bar series?

                  Thanks.

                  GuppyDRV


                  // When the OnBarUpdate() is called from the secondary bar series, do nothing.
                  else
                  {
                  return;
                  }

                  Comment


                    #10
                    I am glad the above code is working for you. The entryOrder == null code should be replaced by a check for a flat market, such as

                    Code:
                    
                    if (Position.MarketPosition == MarketPosition.Flat)
                    The entyOrder == null check was left in from the code sample I copied from; it only makes sense to use if you are also calling OnExecutionUpdate.

                    Providing you are calling the version of EnterLongLimit that I posted, with the BarsInProgress index - that is,

                    Code:
                                  EnterLongLimit(1, true, 1, Lows[1][0], "GranularEntry");
                    then this will enter trades on your secondary bars. If you would like to check for entry conditions on more granular bars, you will instead need to make sure that your BarsInProgress == 1 while checking for entry conditions.
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      Jessica,

                      In the thread posted bellow your college Chelsea implies that the Higher granular resolution (Fast) is an add on in NT8 which does not require working with code. So what is the deal? This differs from this conversation.

                      http://ninjatrader.com/support/forum...d.php?p=491305

                      Any chance we can schedule a phone call as I'm not seeing the proper results with the Walk Forward Optimization with regard to a more granular fill. The Chart still shows fills happening on the primary bar. If I take the (OOS) results, that is the (indicator settings and time date range) and just plug them into a standard back test the trade look as they should be with an smaller bar granularity for the trade executions. Additionally, if you click on an (OOS) period the summary totals that come up are always different from those on the top portion. Please reference the provided pictures. I used the pre-installed simple MA Strategy.

                      BTW, I have hard coded the smaller granularity for the fills with my strategy.

                      This is off course when NT8 build 3.1 doesn't crash which it does every 4 or 5 WFO runs.

                      GuppyDRV
                      Attached Files
                      Last edited by GuppyDRV; 01-16-2017, 07:32 PM.

                      Comment


                        #12
                        While we would be happy to speak with you during a remote desktop session, actively debugging and ensuring the correctness of your code is beyond the scope of the support we may provide. If you would like to speak with us, please send a message to platformsupport[at]ninjatrader[dot]com, referencing 1630499 and Attn:NinjaTrader_JessicaP in the subject line. Our goals for this call would be

                        • Demonstrating the difference between managed Entry and Exit methods using a BarsInProgress index or not
                        • Demonstrating high fill resolution in backtesting and the "free" tick series this gives us

                        Briefly however, my colleague Chelsea was correct in how high fill resolution operates. However, some of the behavior you specified in this thread requires us to go above and beyond what what high fill resolution provides.


                        High fill resolution creates a new data series that the simulated trade desk can use, rather than relying on the data series your script is operating on. If your script could only take action once a day, for instance, you could set up the trade desk to be able to take action once a second.


                        If you would like to do things on the client end (your script) rather than on the server end (the trade desk), such as not initiating trades except during certain times of day as you mentioned in post #5, or you would like more control over the trade desk's clock and the actions they can take, you will need the added power and control that adding your own data series programmatically provides, and need to be able to write more code to handle this.

                        With this power comes responsibility. You are correct in that you can create a strategy that does not require any additional coding, that can take advantage of a more granular series for trading; we would enjoy a "hidden" BarsInProgress index similar to the one I specified which caused trades to take place on the trade desk's clock. However, high fill resolution can only be used on single time frame strategies. If you add an extra time frame to your strategy - as you attempted to do - then you are taking on added responsibility. You can still set up a faster clock for the trade desk, and I demonstrated how earlier (and requested this feature be made possible from the strategy builder), but since you are taking an "unmanaged approach" you must now write more code, and no longer enjoy the benefit of Ninja figuratively writing hidden code for you that high fill resolution provides.


                        I will be happy to clarify any of the above in more detail, or answer any other questions I may, either here or over the phone. Thank you again for this report, and for an opportunity to clarify an involved but I believe very useful feature to our user base.
                        Last edited by NinjaTrader_JessicaP; 01-17-2017, 10:56 AM.
                        Jessica P.NinjaTrader Customer Service

                        Comment


                          #13
                          You guys talk in circles as does your help guide. I asked this exact same question and received your response in post 8. You clearly state "NO" not in the Sltrategy Builder. So now you are saying using the high fill in the strategy builder works? How about on the strategy anylizer screen itself. I get and I think everyone gets that the strategy builder won't do this if you add a second data series. if you "DO NOT" add the second data series are you now saying that it can be done? Some consistency would be nice.

                          Now how about the errors with the results from the walk forward optimization that I attached or the fact thet NT8 crashes when WFO is used. Regardless of any programming issues the system is unstable. I'm a trader, manual discretionary trader, I'm trying to automate some of my stuff. The system needs to work every time it only works acasionally now. Any help along those lines.

                          GuppyDRV
                          Last edited by GuppyDRV; 01-17-2017, 11:27 AM.

                          Comment


                            #14
                            I appreciate your patience, I am doing my best to answer your questions. I may be misunderstanding, because what you are saying now does not line up with the goal I had in mind, and I believe my misunderstanding what your goal is may be adding to our confusion.

                            In this thread you mentioned wanting to know how to add and use a second data series, and wanting to restrict this data series to only trade during some times of day. Are these still goals of ours?

                            If these are still goals of yours, you have to add data series to accomplish these, and can therefore not use high fill resolution, and must use code such as the code I gave you to place trades from primary onto secondary bars. This was where my clear no was coming from.

                            What Chelsea was speaking about with respect to high fill resolution is a different use case. If trading on more granular bars is the only use case we are interested in, and the other things that were mentioned in this thread are no longer interesting, I will be happy to prepare a video demonstrating high fill resolution.

                            Whichever direction we would like to go I or, if you prefer, one of my colleagues will be happy to assist further.

                            With regard to your platform crashing,
                            Please send me your log and trace files, templates, and other files, so that I may look into what occurred.
                            You can do this by going to the Control Center-> Help-> Email Support.
                            Please reference the following ticket number in the body of the email: 1630499
                            Please include Attn:NinjaTrader_JessicaP in the body of your e-mail.
                            IMPORTANT: Please also tick all the boxes in the "Other Files" section.
                            Jessica P.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by seagraph, Yesterday, 03:27 PM
                            1 response
                            23 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by NinjaCustomer, Today, 09:37 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post NinjaCustomer  
                            Started by stalt, Today, 07:52 AM
                            5 responses
                            16 views
                            0 likes
                            Last Post NinjaTrader_PatrickG  
                            Started by im197, 07-30-2019, 12:29 PM
                            2 responses
                            10 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by 7robert, Today, 08:20 AM
                            1 response
                            8 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Working...
                            X