Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Various questions

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

    Various questions

    Hi,
    After converting our NT7 strategy to be NT8 compatible I have several questions collected from the past few days:

    1. I see the following do no exist anymore, what's replacing them? :
    A. Strategy:: Disable()
    B. CalculateOnBarClose
    C. NinjaTrader.Gui.Globals.OutputWindow.Show();

    2. How can I write to output window #2?

    3. Optimization:
    A. I can't seem to set the min/max/stepsize for my parameters when choosing optimization (it won't let me insert ; semi-column).
    B. What is Multi-Objective Optimization?

    4. When State==State.Historical I'm calling my OnStartUp() method which sets the EntriesPerDirection.
    When trying to do so I get an exception:
    "'EntriesPerDirection' cannot be set from this state. Please see the Help Guide article on 'EntriesPerDirection' for more information."
    Why can't I do it? and where is the help guide for that?
    Same for DefaultQuantity, etc. I don't want to call it on "State.SetDefaults" since I'm reading those parameters from a text file (and the file is an input - one of the parameters).

    #2
    Hello liorsham,

    Thank you for your note.

    Please refer to the NinjaTrader 8 Help Guide for the items below:

    1. a) You would use CloseStrategy().
    1. b) Use Calculate, for example: Calculate = Calculate.OnBarClose;
    1. c) This unsupported code from NT 7 has changed, this is also unlisted for NT 8. I will look into this further and follow up when I have further details.

    2. Use PrintTo, for example: PrintTo = PrintTo.OutputTab2;

    3. a) Do you see a Strategy Parameters section in the Strategy Analyzer Settings box?
    3. b) Multi-Objective optimization takes standard optimization a step further by allowing you to choose multiple objectives to test for. When results are returned instead of a singlular list of best results ranked from best to least best instead you will be presented a graph. With multiple objective there is no single best result, instead its up to the trader to choose what is the best tradeoff between two objectives.

    4. You would use State.Configure. For example:
    Code:
    if (State == State.Configure)
    			{
    				EntriesPerDirection			= 1;
    				EntryHandling				= EntryHandling.AllEntries;
    			}

    Comment


      #3
      Hi,
      Thanks for the answers - more followups:

      1. After calling CloseStrategy() from within OnBarUpdate. I keep getting to OnBarUpdate - shouldn't it be stopped?

      2. After running strategy analyzer - going to Settings - Strategy Parameters value is empty, although I have many parameters for the strategy. (also when trying to export the settings, none of the strategy custom parameters is being exported).

      3. In the Instrument list, how can I add continuous contract - e.g. KC##-## and not KC07-15?

      4. When choosing Chart and then trying to apply a strategy - the "Enabled" checkbox is disabled. I can't change it. Why can't I enable it?

      5. I have "AddChartIndicator" from within my strategy - should I set anything else if I want the indicators to be presented on the same panel as the graph? on my indicator I have IsOverlay = true

      6. Regarding Optimization:
      "Do you see a Strategy Parameters section in the Strategy Analyzer Settings box?" Yes, I do see the strategy parameters. But I can't set min;max;range params as in NT7 (it won't accept semicolumn).

      Comment


        #4
        Hello,

        Thank you for the questions.

        For #1: Are you seeing the strategy become disabled in the Control Center? This should close positions and then disable the strategy. if you are not seeing it disable can you provide an example of what you are currently doing?

        For #2: Is this a custom strategy this is happening with or one of the included Sample strategies? Can you try this on one of the samples and see if it is the same outcome?
        If this is only happening for a custom strategy, please try applying the strategy and completing the process, then check the log tab to see if any errors are listed.

        For #3: you can add it by typing in ##-## instead of the contract month. When you click Add and the window turns black to allow you to enter the instrument, you would enter KC ##-##.

        For #4: Are you connected while trying this? If you are not connected the strategies are disabled. Please check this otherwise if you are connected please let me know.

        for #5: The IsOverlay would control if the indicator gets overlaid on the bars or not initially, You can control the panel though, there is a sample in the Tips section on this in the Tip "Adding Indicators to Strategies" http://www.ninjatrader.com/support/f...ead.php?t=3229

        For #6: Does this give an error when you leave the box after entering the values? Can you edit the existing values leaving the semicolon that is there alone? For example if it was 1;3;1 can you change just the 3 to a 4 leaving the remainder of the values unchanged?

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

        Comment


          #5
          2. After running strategy analyzer - going to Settings - Strategy Parameters value is empty, although I have many parameters for the strategy.
          Have you marked the parameters with the [NinjaScriptProperty] attribute.

          Comment


            #6
            Hi,
            Thanks!
            Regarding #1 - I will perform more tests regarding that.
            Adding [NinjaScriptProperty] solved problems 2+6 together.
            From all of my questions - I still have problem with #5 (AddChartIndicator):
            I'm calling:
            AddDataSeries (Data.BarsPeriodType.Minute, 5);
            indicator1.Panel = 1;
            AddChartIndicator(indicator1);

            I want that indicator will be on the main panel, and that it's OnBarUpdate() will be called every 5 minutes. But I don't see it's being called at all (no OnBarUpdate, and the indicator isn't shown at all). is that the way to do it? what can I do?
            Your link didn't help unfortunately.

            More questions:

            A. in NT7 I've used: this.Account.Positions.FindByInstrument(Instrument );
            Now I'm getting an error for that: "'System.Collections.ObjectModel.Collection<NinjaT rader.Cbi.Position>' does not contain a definition for 'FindByInstrument' and no extension method 'FindByInstrument'"
            What's the replacement for that?

            B. I'm experiencing very slow response time when adding a strategy to a chart (sometimes I have to wait more than a minute before it enables me to add a strategy) - are you familiar with that? Is there a NT 8.0.0.3 expected to come soon?

            C. OnStateChange() - State.Transition - what does this state mean?

            D. Regarding OptimizationFitnesses - in NT7 backtesting - I couldn't get the first/last date the strategy was tested on (only the dates of the first/last TRADE). Can I get those members in NT8? how?
            Last edited by liorsham; 06-10-2015, 07:15 AM.

            Comment


              #7
              Hello,

              Thank you for the reply.

              For #5, The link provided does show the correct process to add an Indicator to the chart from a strategy and to be able to view it. Your example the indicator1, if this is a variable that may be the reason, can you try using the example of AddChartIndicator(SMA(12)); first and make sure that displays for you. if it does please include how you have defined indicator1 in the script.

              For the Panel, a 1 would be the secondary panel; this is using an index so it starts at 0 rather than 1 so 0 would be the main chart panel. It sounds like the indicator may not have been added or had an error possibly if it was not displaying.

              For A:

              I do not see this method listed or available. As of current, the only way I could see doing this would be to loop through the account using something similar to the following:

              Code:
              foreach(Position position in Account.Positions)
              {
              	Print(position.Instrument.FullName);
                      // or add the results to your own collection filtering by instrument name. 
              }
              For B: Is this a custom strategy or is this one of the samples? I have not experienced this but I have only been able to test the samples we have and some user scripts so if this is a custom script it is likely the code being used. Can you try one of the samples like the SampleMACrossOver and see if you still have the slow response?

              For C: the State.Transition, you can find a description in the help guide for this here: http://www.ninjatrader.com/support/h...ate.Transition

              For D: the First and Last date, I don't know of any pre made methods for this specifically but you could store the bar 0 Time[0] as a variable and the CurrentBar Time[0] and compare the two, This would work in both nt7 or nt8. Bar 0 would be your start date and the Time[0] would report always the last bar on the chart.

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

              Comment


                #8
                Hello Lior,

                1. I see the following do no exist anymore, what's replacing them? :
                A. Strategy:: Disable()
                I was incorrect, you would actually use SetState(State.Terminated) rather than CloseStrategy().

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by terofs, Yesterday, 04:18 PM
                1 response
                21 views
                0 likes
                Last Post terofs
                by terofs
                 
                Started by CommonWhale, Today, 09:55 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Gerik, Today, 09:40 AM
                2 responses
                7 views
                0 likes
                Last Post Gerik
                by Gerik
                 
                Started by RookieTrader, Today, 09:37 AM
                2 responses
                12 views
                0 likes
                Last Post RookieTrader  
                Started by alifarahani, Today, 09:40 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X