Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Running script and the Strategy Analyzer

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

    Running script and the Strategy Analyzer

    I am currently running the Strategy Analyzer and want to continue working on another script but when I enable another Strategy it keeps switching itself off. Is this normal behaviour as the Analyser is running?

    #2
    Hello GKonheiser,

    Thank you for your note.

    In general, you should be able to enable another strategy while running the Strategy Analyzer. Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?

    I look forward to your response.

    Comment


      #3
      Ya I see it. Its an error running my script.

      Error on calling 'OnBarUpdate' method for strategy 'PivotTrader/090cbfc51f4247be961c84b3ad775753': PivotTrader.DrawLine: startTime must be greater/equal the minimum date but was 01-Jan-01 12:00:00 AM


      This is the code,

      protected override void OnBarUpdate()
      {
      if(CurrentBars[1] == 0)
      return;

      if (Bars.FirstBarOfSession)
      Bars.Session.GetNextBeginEnd(BarsArray[1], 1, out sessionBegin, out sessionEnd);

      // Calculate Pivot Points

      pp = (Highs[1][1] + Lows[1][1] + Closes[1][1])/3;

      DrawLine("pp" + CurrentBars[1], false, sessionBegin, pp, sessionEnd, pp, Color.Red, DashStyle.Solid,1);

      Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd + pp);


      Should I post it in the Programming forum for help?

      Comment


        #4
        Hello GKonheiser,

        Thank you for your response.

        This may not be a programming item. How far back does the Strategy go in real-time or on the Strategy Analyzer? Further back then 2001?

        I look forward to your response.

        Comment


          #5
          Im applying the strategy to the FGBL 12-09 contract.

          Comment


            #6
            Hello GKonheiser,

            Thank you for your response.

            On the Strategy Analyzer what is the From date set to under time frame?

            When enabling your strategy on the Strategies tab of the NinjaTrader Control Center, what is the Days To Load set to?

            I look forward to your response.

            Comment


              #7
              Strategy analyser from 7th Dec 07 and Days to load is 735 on the chart.
              Last edited by GKonheiser; 10-21-2013, 01:02 PM.

              Comment


                #8
                Hello GKonheiser,

                Thank you for your response.

                What Session Template is being used for the strategy?

                Can you attach your code to your response so I may investigate this matter further?

                You will find your strategy located in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy

                If you prefer you can send your strategy to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 938891' in the subject line and a reference to this thread in the body of the e-mail: http://www.ninjatrader.com/support/f...ad.php?t=61520

                Comment


                  #9
                  Here is the code:-

                  #region Using declarations
                  using System;
                  using System.ComponentModel;
                  using System.Diagnostics;
                  using System.Drawing;
                  using System.Drawing.Drawing2D;
                  using System.Xml.Serialization;
                  using NinjaTrader.Cbi;
                  using NinjaTrader.Data;
                  using NinjaTrader.Indicator;
                  using NinjaTrader.Gui.Chart;
                  using NinjaTrader.Strategy;
                  #endregion

                  // This namespace holds all strategies and is required. Do not change it.
                  namespace NinjaTrader.Strategy
                  {
                  /// <summary>
                  /// Enter the description of your strategy here
                  /// </summary>
                  [Description("Enter the description of your strategy here")]
                  public class PivotTrader : Strategy
                  {
                  #region Variables

                  private double r2;
                  private double r1;
                  private double pp;
                  private double s1;
                  private double s2;

                  private DateTime sessionBegin;
                  private DateTime sessionEnd;

                  #endregion

                  /// <summary>
                  /// This method is used to configure the strategy and is called once before any strategy method is called.
                  /// </summary>
                  protected override void Initialize()
                  {

                  Add(PeriodType.Day, 1);



                  CalculateOnBarClose = true;

                  }

                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                  if(CurrentBars[1] == 0)
                  return;

                  if (Bars.FirstBarOfSession)
                  Bars.Session.GetNextBeginEnd(BarsArray[1], 1, out sessionBegin, out sessionEnd);

                  // Calculate Pivot Points

                  pp = (Highs[1][1] + Lows[1][1] + Closes[1][1])/3;

                  DrawLine("pp" + CurrentBars[1], false, sessionBegin, pp, sessionEnd, pp, Color.Red, DashStyle.Solid,1);

                  Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd + pp);


                  }



                  }


                  }


                  Session template is Eurex Fixed Income Futures

                  Comment


                    #10
                    Hello GKonheiser,

                    Thank you for your response.

                    I am unable to reproduce this behavior. To clarify on your steps here you are backtesting the strategy on the FGBL 12-09 but attempting to run it in real-time on the FGBL 12-13 correct?

                    Please provide all necessary steps to re-create this item.

                    Comment


                      #11
                      Sorry if I was unclear. I am running the optimizer on one Script from dec 07 to dec 09 and I'm working on a second script applying to a chart of 2 year of data. But it doesn't matter what I apply the second strategy too, as long as the optimizer is running it automatically disables the strategy.

                      Comment


                        #12
                        Hello GKonheiser,

                        Thank you for your response.

                        I see the same behavior when running a backtest and then enabling my strategy on the Strategies tab, however this only occurs if I click to enable the strategy and then click within the Strategies tab on the Control Center even on a different region of the window.

                        For this not to happen you would need to click outside the Control Center window after checking the option for enable on the strategy.

                        I will investigate this matter further on my end and follow up with you on any additional information I have.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Segwin, 05-07-2018, 02:15 PM
                        14 responses
                        1,788 views
                        0 likes
                        Last Post aligator  
                        Started by Jimmyk, 01-26-2018, 05:19 AM
                        6 responses
                        837 views
                        0 likes
                        Last Post emuns
                        by emuns
                         
                        Started by jxs_xrj, 01-12-2020, 09:49 AM
                        6 responses
                        3,293 views
                        1 like
                        Last Post jgualdronc  
                        Started by Touch-Ups, Today, 10:36 AM
                        0 responses
                        12 views
                        0 likes
                        Last Post Touch-Ups  
                        Started by geddyisodin, 04-25-2024, 05:20 AM
                        11 responses
                        62 views
                        0 likes
                        Last Post halgo_boulder  
                        Working...
                        X