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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-27-2012, 05:30 PM   #1
JimTrader75
Junior Member
 
Join Date: Jan 2012
Location: Texas
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default Backtesting strategy doesn't yield enough entries

Hello. I am new to NT and trading in general. I have taken a few weeks to acclimatize myself with the NT environment, but I am needing a little nudge if it is at all possible. I have created a strategy. I am using the free Kinetic EOD data and want to backtest my strategy. I will try to simplify the idea here: when the current days high is less than yesterdays high, and the current days low is less than yesterdays low, and yesterdays high is less than the 2 days ago high, and yesterdays low is less than the 2 days ago low, enter a short stop order when the price gets above todays high. It should stop out when it gets below yesterdays low. This is what my conditions and actions look like thus far:

High[0]>High[1]
Low[0]>Low[1]
High[1]<High[2]
Low[1]<Low[2]

EnterShortStop(1,Low[1],"TestEntry")

I connect to the Kinetic EOD before starting. When backtesting, I set type to Day, Value 1, From 9/1/2011 to 1/26/2012 (today), leaving the rest of the values at default.

I find several problems:
1) I am not sure how to tell it to enter above todays High.
2) When I back test this against 4 months worth of data, I never get more than 1 entry (which is incorrect), though I see that the conditions are met many times during that period and it doesn't exit (stop) until today's date.

I will apologize in advancefor my ignorance, and thank you in advance for any help and/or guidance.

- Jim
JimTrader75 is offline  
Reply With Quote
Old 01-27-2012, 05:51 PM   #2
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,209
Thanks: 24
Thanked 1,229 times in 1,000 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by JimTrader75 View Post
Hello. I am new to NT and trading in general. I have taken a few weeks to acclimatize myself with the NT environment, but I am needing a little nudge if it is at all possible. I have created a strategy. I am using the free Kinetic EOD data and want to backtest my strategy. I will try to simplify the idea here: when the current days high is less than yesterdays high, and the current days low is less than yesterdays low, and yesterdays high is less than the 2 days ago high, and yesterdays low is less than the 2 days ago low, enter a short stop order when the price gets above todays high. It should stop out when it gets below yesterdays low. This is what my conditions and actions look like thus far:

High[0]>High[1]
Low[0]>Low[1]
High[1]<High[2]
Low[1]<Low[2]

EnterShortStop(1,Low[1],"TestEntry")

I connect to the Kinetic EOD before starting. When backtesting, I set type to Day, Value 1, From 9/1/2011 to 1/26/2012 (today), leaving the rest of the values at default.

I find several problems:
1) I am not sure how to tell it to enter above todays High.
2) When I back test this against 4 months worth of data, I never get more than 1 entry (which is incorrect), though I see that the conditions are met many times during that period and it doesn't exit (stop) until today's date.

I will apologize in advancefor my ignorance, and thank you in advance for any help and/or guidance.

- Jim
You have not specified any Exits, so you will have one entry and never exit. You need to specify some means of exiting the trade.
koganam is online now  
Reply With Quote
Old 01-27-2012, 06:00 PM   #3
JimTrader75
Junior Member
 
Join Date: Jan 2012
Location: Texas
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Oh, I thought the second parameter (stop price - in this case "Low[1]") in the EnterShortStop would be the "exit". Btw, I am using the Strategy wizard. I am also actually a c# programmer by trade (one of the reasons I liked NT vs other packages), so if I have to edit the code, that will be fine. Again, forgive my ignorance if this sounds stupid.

- Jim
JimTrader75 is offline  
Reply With Quote
Old 01-27-2012, 06:05 PM   #4
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,209
Thanks: 24
Thanked 1,229 times in 1,000 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by JimTrader75 View Post
Oh, I thought the second parameter (stop price - in this case "Low[1]") in the EnterShortStop would be the "exit". Btw, I am using the Strategy wizard. I am also actually a c# programmer by trade (one of the reasons I liked NT vs other packages), so if I have to edit the code, that will be fine. Again, forgive my ignorance if this sounds stupid.

- Jim
When you enter with a EnterShortStop(), the Stop price is the trigger price to put you in with a MarketOrder.

There are various methods for exiting trades. ExitShort(), SetStopLoss(), SetTrailStop(), and many others. Look them up in the documentation.

ref: http://www.ninjatrader.com/support/h...er_methods.htm
koganam is online now  
Reply With Quote
The following user says thank you to koganam for this post:
Old 01-27-2012, 06:32 PM   #5
JimTrader75
Junior Member
 
Join Date: Jan 2012
Location: Texas
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

That helped. I am getting more trades now, but the entries and exits still don't seem right. I'll keep plodding away and come back if I get completely stuck.

Thanks!

- Jim
JimTrader75 is offline  
Reply With Quote
Reply

Tags
backtesting, data, historical, kinetic, strategy

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
calculate yield from interest rate future zweistein Indicator Development 8 06-04-2011 04:53 AM
Backtesting with Bid Ask entries? kenb2004 Strategy Development 9 01-03-2011 05:16 AM
NT 7 Backtesting: How to Backtest Short and Long futures entries on Same Day ChiTrader2000 Version 7 Beta General Questions & Bug Reports 5 11-29-2010 08:32 AM
Simple strategy yield no result (Even SampleMACrossOver) kw123 Version 7 Beta General Questions & Bug Reports 0 12-21-2009 12:32 PM
Entries: 1 Bar Slower when backtesting samuelg Strategy Development 2 04-13-2008 07:01 PM


All times are GMT -6. The time now is 03:59 PM.