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 01-25-2012, 12:21 AM   #1
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default Strategy Analyzer Date Backtest Range Changes

This was an issue that was previously posted (http://www.ninjatrader.com/support/f...ad.php?t=37527)

When I try to run backtests through the strategy analyzer (even with the premade samples) it returns no results and gets stuck on:

start date 4/13/2006

end date 4/13/2006

no matter what start/end dates I select.

Now when I open a separate chart and run it through the right click menu it works fine.

It also seems to completely ignore stop loss or profit targets.

The last question I have is:

if I am in the strategies menu from right clicking on a separate chart and under order properties I select account size of X and I select by account size under "set order quantity" shouldn't it use the maximum number of contracts it can buy based off the current account balance?

Thank you.
stuck is offline  
Reply With Quote
Old 01-25-2012, 03:41 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 25,614
Thanks: 424
Thanked 1,641 times in 1,603 posts
Default

Hello, what data provider / broker would you be using here? What timeframe are you testing on in the Strategy Analyzer?

How are the stop loss and profit targets coded in? Please note that for a percentage based target for example 0.01 would equal 1 percent.

For the order qty question, it would also be important to check which margin you've setup under Tools > Instrument Manager for the product you're trading.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-25-2012, 03:43 AM   #3
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 25,614
Thanks: 424
Thanked 1,641 times in 1,603 posts
Default

Hello, what data provider / broker would you be using here? What timeframe are you testing on in the Strategy Analyzer?

How are the stop loss and profit targets coded in? Please note that for a percentage based target for example 0.01 would equal 1 percent.

For the order qty question, it would also be important to check which margin you've setup under Tools > Instrument Manager for the product you're trading.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-25-2012, 08:57 AM   #4
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

Kinetick free EOD

Time-frame: Daily

stop loss/profit: in the edit strategy window I click add, select stop loss then:

from entry signal: "Long Entry" #this is the name of my long entry

mode: percent #doesn't seem to matter what I select with this

value: .01 #clearly messes something up because without it I have a max drawdown of ~30% and with it the max drawdown is more than 70%

simulated: true #or false, has no effect

The margin box is greyed out.
stuck is offline  
Reply With Quote
Old 01-25-2012, 09:28 AM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 25,614
Thanks: 424
Thanked 1,641 times in 1,603 posts
Default

The simulated option would not be available in backtesting, it would play a part only if the strategy was traded realtime (is the stoploss submitted so other could see it, or would it be locally held?).

Would you mind attaching the strategy here or sending it to support at ninjatrader dot com so we could give a quick run for you?

Which instrument(s) are you trading here? Stocks?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-25-2012, 09:53 AM   #6
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

at this point I don't really care if the stop is held local/submitted. I'm trying to learn the interface with something basic.

The strategy is attached as a .txt let me know if you need a different file type.

Instruments:
This morning I tried everything.
Ideally I want to be able to back test on indexes in addition to stock/futures.

also I'm having trouble downloading historical daily (sometimes) and intraday (always) regardless of the data feed. I tried to use ToS data feed through TD and that gave me a couple of different errors. When I use continuous contracts it doesn't do anything.

Is there any easy way to convert a csv file to your format? I have some data but the year is in the wrong place and there is an extra data field.

edit: also when I try to import data why does it force me to use "stock" instead of futures (so I could set a multiplier) or index, even when the exchange is set to globex?
Attached Files
File Type: txt LongMATest.txt (33.5 KB, 8 views)
Last edited by stuck; 01-25-2012 at 10:06 AM.
stuck is offline  
Reply With Quote
Old 01-25-2012, 10:57 AM   #7
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 381 times in 371 posts
Default

Stuck

I am happy to assist you on behalf of Bertrand.

As far as your strategy is concerned, I can get it to work. Please keep in mind testing on a daily time frame may only enter very few trades. Please increase the date ranges you are using and test again.

Quote:
I'm having trouble downloading historical daily (sometimes) and intraday (always) regardless of the data feed. I tried to use ToS data feed through TD and that gave me a couple of different errors. When I use continuous contracts it doesn't do anything.
ToS is not supported by NinjaTrader at this time. You should only be able to get equities data from TD Ameritrade at this point.

Quote:
Is there any easy way to convert a csv file to your format? I have some data but the year is in the wrong place and there is an extra data field.
You can import CSV file data into NinjaTrader using Tools > Historical Data Manager > Import. You can set the timezone formatting here. If the time zone is not formatted to one of the types available, you would need to run some script on your end to format it appropriately, or do it manually.

Here is an example of NT format : 20120118 140000;1.2803;100000

Quote:
edit: also when I try to import data why does it force me to use "stock" instead of futures (so I could set a multiplier) or index, even when the exchange is set to globex?
Are you attempting to import using the Historical Data Manager?

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 01-25-2012, 12:13 PM   #8
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

If this is relevant I'm using the 64 bit version of the latest version of NT. I have tried everything that I have listed on this thread in the 32 bit version.

I'm using a large date range (50yrs) and it still does not work.

I use historical data manager to import the data. That set is formatted correctly. Another problem is when I try to edit data set information through instrument manager I can't change instrument type, margin value, point value: these are greyed out. When I try to edit other settings that I can access and hit ok it tells me to select an extra exchange besides default. When I do this and click ok I see the ok button do the click response but nothing happens. The window will only close if I hit cancel.

After I do this sometimes it can't get EOD data from kinetick. I then have to restart NT.

NT also refuses to load any bars for a chart when I select the uploaded data set.

As far as NT supporting other time formats, it doesn't. It only supports one format but it will adjust timestamps of that format for different time zones as selected. This seems like an obtuse design when supporting multiple time formats is a pretty standard feature and easily supported by most languages...

I have some experience with debugging and I know that often it is a user error. I'm trying to find what I'm doing wrong but I have spent 6 hours on this today and can't figure it out. I looked at the help guide and nothing from that has helped.

I have also restarted my computer and re installed NT if that is helpful.

As for the backtest all I can tell you is with the exact same code that I gave you it refuses to run on my computer.

stuck is offline  
Reply With Quote
Old 01-25-2012, 12:20 PM   #9
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 381 times in 371 posts
Default

Stuck,

Quote:
I use historical data manager to import the data. That set is formatted correctly. Another problem is when I try to edit data set information through instrument manager I can't change, instrument type, margin value, point value: these are greyed out. When I try to edit other settings that I can access and hit ok it tells me to select an extra exchange besides default. When I do this and click ok I see the ok button do the click response but nothing happens. The window will only close if I hit cancel.
You wont be able to modify instrument type as well as the other fields you mentioned for existing instruments, I would suggest creating a new instrument instead.

Your going to have to convert the file into NinjaTrader format. Basically you will need to set the file name to something like this : $EURUSD.Last.txt. You can alternatively use Metastock format.

Quote:
As far as NT supporting other time formats, it doesn't. It only supports one format but it will adjust timestamps of that format for different time zones as selected. This seems like an obtuse design when supporting multiple time formats is a pretty standard feature and easily supported by most languages...
Apologies, I mean time-zones.

Quote:
I have some experience with debugging and I know that often it is a user error. I'm trying to find what I'm doing wrong but I have spent 6 hours on this today and can't figure it out. I looked at the help guide and nothing from that has helped.
Your code works on my end. What are your other settings for the strategy when you run it in the wizard? Could you perhaps take a screen shot?
NinjaTrader_AdamP is offline  
Reply With Quote
Old 01-25-2012, 01:02 PM   #10
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

how do I create a new instrument that links back to a local file for the data?

ok I got it to run the back test in the strategy analyzer but it is stuck with 1 contract.

I set the account size to 100000, margin value is 0 and point value is 1 for the item I used to backtest.

There is also a problem with the data from 1970 to the end of 1977, 6/21/1978 to 7/26/1983 (there are a few random bars in between with open != close. The open and close are always the same. This is through kinetick EOD.

Also the stop loss is still failing. What was the max loss on a trade when you ran it?
stuck is offline  
Reply With Quote
Old 01-25-2012, 02:09 PM   #11
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 381 times in 371 posts
Default

stuck,

Quote:
how do I create a new instrument that links back to a local file for the data?
The data you import should link to the instrument in the name : $EURUSD.Last.txt

So this file would like to the Last data for $EURUSD instrument.

Quote:
ok I got it to run the back test in the strategy analyzer but it is stuck with 1 contract.
When you do a backtest, in the "Order Properties" section in the Strategy properties, ensure that "Default quantity" is set appropriately.

Quote:
There is also a problem with the data from 1970 to the end of 1977, 6/21/1978 to 7/26/1983 (there are a few random bars in between with open != close. The open and close are always the same. This is through kinetick EOD.
This can be expected if there are after hours trading.

Quote:
Also the stop loss is still failing. What was the max loss on a trade when you ran it?
1 percent of 1.4443 for example is approximately 0.0144. This would be the amount the price is allowed to move in the opposite direction before a stop loss is triggered. Its currently performing as expected with your strategy on my end.

Please let me know if I may assist further.
Last edited by NinjaTrader_AdamP; 01-25-2012 at 04:10 PM.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 01-25-2012, 03:50 PM   #12
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

What I'm saying is that isn't what is happening.

I upload the file, it says everything worked.
(file name is test.Last.txt if the $ sign is in front I get an error)

I go to edit in historical data manager to make sure the data is there, it is.

then file->new->chart select test
make sure times match (day data to days)

then I get error on loading chart data for "test Default": failed to retrieve data from (any of the data services available)

then I go to tools-> instrument manager
select test from the list click edit
try to edit any of the data and hit "ok"
ERROR you must assign an exchange in addition to the 'Default' exchange
select one at random because the instrument ISN'T listed.
click ok
the ok button responds but nothing happens. The instrument editor window remains open.

now I X that out because it is useless.
back on the instrument manager window
click new
???????????????????? (don't know what to do)
enter test.Last.txt as master instrument
select default
try to hit ok
WARNING YOU MUST SET A LEAST ONE 'SYMBOL MAP' VALUE
??? It is a local file... not on a website
C+P the directory of the file into External
try to load, same error.

entries per direction is set to more than one (it is 100000 right now to make sure)
still uses only 1 contract
should have adequate capital defined if the calculation for number of contracts =capital/facevalueofcontract

"This can be expected if there are after hours trading."
Frankly that doesn't make sense unless there is a bug in the data. I have data that doesn't do that and includes AH which is part of the reason I would like to be able to import local data sets.

Stop loss was fixed after copying the original, deleting that strategy, and pasting into a new strategy.
stuck is offline  
Reply With Quote
Old 01-25-2012, 04:10 PM   #13
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 381 times in 371 posts
Default

stuck,

Thanks for your note.

Could you possibly post this data?

What instrument are you attempting to load back to 1970?

A symbol map needs to be set, you can just set the symbol name in the "Kinetick" section in the "Misc" tab. After this you should be able to save the new instrument.

As far as your strategy running with only 1 order, please check the "Order Properties" section in the Strategy properties, ensure that "Default quantity" is set to the proper number.

I look forward to helping you resolve your issue.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 01-25-2012, 04:33 PM   #14
stuck
Junior Member
 
Join Date: Jan 2012
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
Default

I would prefer not to post it on the forum but I can probably PM it.
Maybe we can arrange something...

INDU

The problem with default order quantity is that I want it to take a full clip all the time. There isn't a setting for this as far as I know. It would also be useful to have functions so you could scale into positions properly.
stuck is offline  
Reply With Quote
Old 01-25-2012, 04:41 PM   #15
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 381 times in 371 posts
Default

stuck,

All this is possible in NinjaScript, it just takes some extra coding steps.

Here is a link to reference samples for advanced coding of strategies : http://www.ninjatrader.com/support/f...splay.php?f=30

You can send an email to Support at NinjaTrader dot com with "ATTN : Adam Ticket : 598502" in the message body or subject. We can work together privately this way.

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AdamP for this post:
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
Strategy Analyzer not running when clicking 'Backtest' adamus Strategy Analyzer 4 03-08-2011 09:20 AM
Obtaining Begin/End Date in Strategy Analyzer bobcat70 Strategy Development 1 08-02-2010 07:06 AM
Compiling a Strategy resets backtest properties in Analyzer adamus Version 7 Beta General Questions & Bug Reports 4 05-08-2010 04:56 PM
Date column in Strategy Analyzer - Periods tab adamus Version 7 Beta General Questions & Bug Reports 4 04-19-2010 11:23 AM
In strategy analyzer backtest, trades stopped anothertoy Strategy Analyzer 17 05-26-2009 08:24 AM


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

FULL RISK DISCLOSURE: Futures trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.