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 > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 06-04-2009, 10:31 AM   #1
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Backtest help

My strategy is now ready to run. I would like to backtest it and would appreciate help with the following issues:

1-How set session begin/end times for EURUSD that starts 5:30 pm Sunday and ends 5:30 pm Friday?

2-How to specify commission? (Assume spread for EURUSD is 3 pips.)

3-How set "Exit on Close"?

4-One of my parameters is maximumLoss which has a default setting of -$150. When I enter that value it automatically changes to 1?

5-I am currently connected to both TradeStation and Gain Capital. However, although time period is set to 1/1/09 to today and 30 minute interval, I can't get the chart or the backtest to recognize those settings. Historical data doesn't show and trades don't show on chart.
skat100 is offline  
Reply With Quote
Old 06-04-2009, 10:42 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

1. You set a start time and an end time for a day at a time. You cannot set it from Sunday to Friday. If you have some more specific needs then you should instead set it to 24 hrs sessions and program time filtering as need be.

2. You need to set this up in the Instrument Manager and be sure to select "Include commissions" when you run your strategy.

3. When you run your strategy please set it to true.

4. You need to change your code. Your code is stating minimum value for it is 1 in the Properties region for that parameter.

5. Please only connect to the data provider you wish to try and retrieve data from first. GAIN does not provide you that amount of historical data.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-04-2009, 11:44 AM   #3
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Sim101 trades

Thanks for all the help.

In the Trades Tab in the Conrol Center, I have 7 trades. Although the Profit and Loss entries are red for losses and black for gains, all the amounts are zeros.

How do I correct this?
skat100 is offline  
Reply With Quote
Old 06-04-2009, 11:52 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

You will need to look at the executions tab and correlate what your gains and losses actually are and try to correlate them back to what your trades are.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-05-2009, 09:52 AM   #5
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Backtest

Thanks for your reply.

I have just backtested my strategy. The performance report shows profit/loss on each trade as zero. However, it is obvious from the entry and exit prices that almost every trade is either plus or minus dollars.

Since profitability is the only reason for trading, one would expect the performance to be expressed in dollars. How can I correct this?
skat100 is offline  
Reply With Quote
Old 06-05-2009, 10:03 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Please ensure you are trading with enough quantity. In forex with prices being off to 4 decimal places, you can get trades that seemingly don't net anything.

Please see this article: http://www.ninjatrader-support.com/H...ngFXStrategies
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-10-2009, 10:17 AM   #7
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default 4 Questions

My strategy is running simulated EURUSD 30 min.

A trade description shows S.LRx 0.1M@1.4120,

1-Is 0.1M $100,000? $10,000? $1,000?

2-How can I change this? (I am using data from TradeStation. When I enter trades, I use 1 for 1 contract.)

The last trade shows as 0930 June 4. There are no entries on the chart after 1100 am June 5.

3-How can I bring the chart up to today’s date?

In a backtest, all values show as zero. Quantity is set as 100,000.

4-What am I not doing correctly?
skat100 is offline  
Reply With Quote
Old 06-10-2009, 10:28 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 976 times in 959 posts
Default

Skat100,

1. This is one regular lot of 100K

2. In the backtest try entering 100000 to trade a full lot as in 1

3. You would need to import a fresh set of historical data to backfill the chart to the point where you connect to realtime data.

http://www.ninjatrader-support.com/H...ownloader.html

Most likely you would need to make sure all data is present before you backtest, and then enter the correct quantity to generated the trade staticstics related to the current lotsize you're looking for.
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-10-2009, 10:46 AM   #9
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Strategy Implementation

Thanks for your reply.

Historical data is present back to 1/1/2009. Quantity is set to 100000. One problem is that the chart shows no data after 6/5. There is one burst of trade activity for a few days in May and on June 1. Otherwise, there are no trades showing. The performance chart shows all zeros.

How do I correct these problems?
skat100 is offline  
Reply With Quote
Old 06-10-2009, 10:51 AM   #10
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 976 times in 959 posts
Default

Please export the data and check that really all the needed historical data is present in your symbol, if not - you would then need to do a fresh data import. Have you backtested also with the SampleMACrossOver strategy?
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-10-2009, 03:43 PM   #11
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Backtest Performance Report

I have followed all your suggestions.

After running the Backtest Performance Report, the profit / loss figures do not make sense.

For example, trade # 51 shows entry on a short sale at 1.3387 with an exit at 1.3350 and a profit of $0.04.

In pips the profit was 37. In dollars that would be $370.00, not $0.04.

How can I troubleshoot this?
skat100 is offline  
Reply With Quote
Old 06-10-2009, 03:50 PM   #12
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

What quantity did you submit at? 100,000 quantity = 1 lot. Please show us exactly what you are seeing in the Strategy Analyzer with a screenshot for a run off of the SampleMACrossOver strategy. Thank you.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-10-2009, 04:01 PM   #13
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Please provide a screenshot of the Strategy Analyzer showing the issue. Thank you.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-11-2009, 10:53 AM   #14
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Some new problems

1-When I started today, I opened a EURUSD chart. Data from 2:48 am to 11:46 am is missing. I re-imported the data but the data is still missing.

2-I tried to add my stategy to the chart but "Strategies" on the tool bar is greyed out. Control S does not work.

I have been trying for several weeks now to translate a TradeStation strategy to Ninja. This has been an agonizing experience. I would like to make a suggestion. All the controls needed to develop and operate a strategy are in different places. Why not create a dashboard which collects appropriate collections of instructions for each task? This would not be a big programming job. It would simply be a layout job plus links.

Thanks for your help. I do appreciate the rapid responses.
skat100 is offline  
Reply With Quote
Old 06-11-2009, 11:08 AM   #15
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 976 times in 959 posts
Default

skat100, just to clarify for the TradeStation connection this is expected - when you're not connected 24 hrs live collecting data, you would need to reload this historical data using the TS Data Download strategy. Please export the data from the EURUSD symbol and check if it's present as you expect. If not delete the data and export a fresh generated txt file from TradeStation.

Do you have the ChartTrader panel enabled by any chance? This will prevent the strategies button from being available.

Thanks for the suggestions!
NinjaTrader_Bertrand is online now  
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
Unable to backtest cowcool Strategy Analyzer 1 05-31-2009 11:01 AM
BackTest Settings ??? RJay Strategy Analyzer 2 03-11-2009 02:47 PM
Help with backtest Bluemaze Strategy Development 1 01-31-2009 08:35 AM
Backtest a strategy jriverac Strategy Development 5 05-23-2008 03:30 AM
Backtest not available BradB Strategy Analyzer 9 11-10-2007 09:41 PM


All times are GMT -6. The time now is 06:45 AM.