NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 08-07-2012, 08:19 AM   #1
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default 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);
                    }                    
                } 
       }
            }
tinkerz is offline  
Reply With Quote
Old 08-07-2012, 08:25 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

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.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-07-2012, 10:05 AM   #3
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

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());    
                }
            }
tinkerz is offline  
Reply With Quote
Old 08-07-2012, 11:04 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

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.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-07-2012, 12:23 PM   #5
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

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?
tinkerz is offline  
Reply With Quote
Old 08-07-2012, 12:34 PM   #6
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello tinkerz,
Yes, that would depend on how far your connectivity provider provides data for.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-07-2012, 02:02 PM   #7
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

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?
tinkerz is offline  
Reply With Quote
Old 08-07-2012, 06:59 PM   #8
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

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?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-08-2012, 01:08 PM   #9
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

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
tinkerz is offline  
Reply With Quote
Old 08-08-2012, 01:33 PM   #10
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,683
Thanks: 116
Thanked 189 times in 184 posts
Default

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.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 08-08-2012, 01:46 PM   #11
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

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
tinkerz is offline  
Reply With Quote
Old 08-08-2012, 01:59 PM   #12
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,683
Thanks: 116
Thanked 189 times in 184 posts
Default

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.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 08-08-2012, 02:02 PM   #13
tinkerz
Senior Member
 
Join Date: Dec 2009
Posts: 248
Thanks: 0
Thanked 1 time in 1 post
Default

No I never had that message, the prints and trades line up, they both start in 2009
tinkerz is offline  
Reply With Quote
Old 08-08-2012, 03:09 PM   #14
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,683
Thanks: 116
Thanked 189 times in 184 posts
Default

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.
NinjaTrader_PatrickH is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Statement that allows for seconds suprsnipes Indicator Development 4 06-13-2012 09:08 PM
Including Label Row In Market Analyzer Print florida99 Suggestions And Feedback 8 10-07-2011 01:17 PM
How to print strategy analyzer summary page? ju1234 Strategy Analyzer 4 02-01-2011 02:51 PM
Adding a print statement gives different results. moldham Strategy Development 3 04-25-2010 10:43 PM
Does using Print() slow down the strategy analyzer? cunparis Strategy Development 2 01-07-2009 04:21 AM


All times are GMT -6. The time now is 11:16 PM.