Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Print statement in strategy analyzer

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

    Print statement in strategy analyzer

    Does the print statement in the strategy analyer not work when you run a back test.

    I am trying the following loop to print the close and date and am not getting anything to the output menu

    Thanks

    Tinkerz


    Code:
            protected override void OnBarUpdate()            
            {
                
                if (BarsInProgress == 0)
                {
                    
                
                for (int index = 1; index < 41; index++) 
                {
                    if (BarsInProgress == index)
                    {
                        if (CurrentBars[index] > 0)
                        {
                        Print(Closes[index][0]+"//"+Times[index][0].ToString()+"//index##"+index);
                        }                    
                    } 
           }
                }

    #2
    Hello tinkerz,
    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      This is still foxing me, I know there is data in the multi indicator script that only goes back to 2011.
      If I set the main series back to 2005, I want to print a date when a close does not have value on the 40 added in instruments.

      But if there is no close for that date whats the exception that will pick it up.

      I am trying .Nan in a loop

      The problem is that if there is no data how to I pick it up?

      Thanks



      Code:
              protected override void OnBarUpdate()            
              {
                         
                  for (int index = 1; index < 41; index++) 
                  {
                      if (double.IsNaN(Closes[index][0]))
                      {
                      Print(index+"//"+Times[0][0].ToString());    
                      }
                  }

      Comment


        #4
        Hello tinkerz,
        If you use the below code can you get the correct print.

        Code:
        for (int index = 1; index < BarsArray.Length; index++) 
        {
        	if (CurrentBars[index] < 0) continue;
                Print(index+"//"+Times[0][0].ToString());    
        }
        I look forward to assisting you further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Ok 1 more questions thanks

          I am trying to run a backtest from 2005, but the prints start from 17/12/2009, is thier a limit on how long a lookback period I can use?

          Comment


            #6
            Hello tinkerz,
            Yes, that would depend on how far your connectivity provider provides data for.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              I am using ES ##-## in position zero, but the trading starts from 2009 even though I am setting the start date in 2005,

              Even with the previous code I dont get any dates 2005-2009 in the print statement.

              But the ES data is there as I can see the chart

              Why would I not see data before 2009?

              Comment


                #8
                Can you please clarify who you connect to for data? This is displayed in the bottom left hand corner of the NinjaTrader Control Center.

                Do you have data for the ES ##-## in Tools--> Historical Data Manager?
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  I use the free daily feed from Kinetic, I do have ES ##-## in the Historical Data Manager, the date range is 01/01/2005 31/12/2012

                  Comment


                    #10
                    Hello tinkerz,

                    Thank you for your response.

                    Please note that the EOD connection provides access to historical daily data only, allowing you to access Daily, Weekly, Monthly and Yearly data for free.

                    The data you see from 01/01/2005, is this Daily data?
                    It is not possible to have data that ends on 31/12/2012 as this would be a future date that data would not exist for at this time.
                    And please advise what interval you are running the strategy on, is it a Daily interval such as Day, Week, Month or Year?

                    I look forward to assisting you further.

                    Comment


                      #11
                      Daily data, when I look in edit I see its from 03/01/2005 to 06/08/2012, I picked up the previous dates from export.

                      Thanks

                      Comment


                        #12
                        Hello tinkerz,

                        Thank you for your response.

                        At the top of your Output Window (you will have to scroll up to get to the top of Ouput Window) do you see the following message listed?

                        "You have reached the maximum threshold of the Output window. Some of your output messages have been suppressed"

                        If so, you have reached the limit for the Output Window. If you are running into the limit of the output window, you should consider moving this to a file. You can also consider programatically clearing this with ClearOutputWindow().
                        Information on ClearOutputWindow() can be found at the following link: http://www.ninjatrader.com/support/h...tputwindow.htm

                        If you wish to move this information to another file, these samples can help with writing information to a file:
                        Using StreamWriter to write to a text file: http://www.ninjatrader.com/support/f...ead.php?t=3475
                        Using System.IO File properties to write to and read from a text file: http://www.ninjatrader.com/support/f...ead.php?t=3477

                        Please let me know if you are not receiving the message listed above.

                        Comment


                          #13
                          No I never had that message, the prints and trades line up, they both start in 2009

                          Comment


                            #14
                            Hello Tinkerz,

                            Thank you for your response.

                            Please send a note to support[at]ninjatrader[dot]com with "ATTN: Patrick" 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=51692

                            I would like to test your Strategy on my end using data from Kinetick EOD Free for the same time period.
                            Please attach your strategy to your response, you will find your strategy on your PC in the (My) Documents\NinjaTrader 7\bin\Custom\Strategy folder.
                            Please also take a screenshot the Backtest parameter window so I may recreate your exact settings on my end.

                            I look forward to assisting you further on this matter.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by zstheorist, Today, 07:52 PM
                            0 responses
                            3 views
                            0 likes
                            Last Post zstheorist  
                            Started by pmachiraju, 11-01-2023, 04:46 AM
                            8 responses
                            149 views
                            0 likes
                            Last Post rehmans
                            by rehmans
                             
                            Started by mattbsea, Today, 05:44 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post mattbsea  
                            Started by RideMe, 04-07-2024, 04:54 PM
                            6 responses
                            33 views
                            0 likes
                            Last Post RideMe
                            by RideMe
                             
                            Started by tkaboris, Today, 05:13 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post tkaboris  
                            Working...
                            X