NinjaTrader Support Forum  

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 09-06-2007, 06:55 PM   #1
hedgefundofone
Junior Member
 
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default EnterLongStop

Hello,
Using the wizard, I am developing and testing a strategy to enter long position on upside breakouts. When the strategy identifies a break-out on the daily close, it appears that the strategy tries to enter the position at open of the next day. Of course, many breakouts fail, some badly. E.g., on Day 0, the breakout is identified, then the next day, the Strategy Analyzer enters a long position at the open when the price gaps down, an obvious failure of the breakout. To provide some protection from failure on the very date of entry, I have tried to use the EnterLongStop so that the stop would only enter if the price is at a level that makes sense. If I set the stop for EnterLongStop as Low[0], I avoid the entry date gaps down, but legitimate breakouts are not taken even though the price on the day of entry is at or above the Low of day 0, the date on which the breakout was identified.

EnterLongStop(100, Low[0], "ChannelBreakout");

I want the Analyzer to enter a long position at market if the price is >= the low of Day 0. Am I misinterpreting how the EnterLongStop method works?
hedgefundofone is offline  
Reply With Quote
Old 09-07-2007, 08:27 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

The reason your EnterLongStop() is not working as you expect is because of the way buy stop orders need to be placed. Buy stop orders need to be submitted at a price above the current price, but when you place them below the current price the order is rejected. Because of the nature of backtesting we cannot "peak" inside a bar and only know if an entry condition was satisfied at the close of the bar. This means all entry orders are submitted at the open of the next bar. What happens when the price gaps up above your stop price on next bar your order is invalid and rejected. This article is very useful in helping you understand the discrepancies between real-time testing and backtesting. http://www.ninjatrader-support.com/H...sBacktest.html

If you simply want to execute an order at a specific price you may find EnterLongLimit() to fit the bill.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-08-2007, 05:10 PM   #3
hedgefundofone
Junior Member
 
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default EnterLongLimit

Thanks, Josh. The link was helpful. I see what is meant about Real-Time vs. Backtesting. EnterLongLimit would still allow purchasing the gap-down failure of the breakout, which is what I am trying to avoid. In some iterations, I did try the EnterLongStopLimit, but, as I recall, it always assumed that the full limit was taken even though the open was at or above the stop and lower than the limit. I figured that was to assume that the limit was acceptable. Will play around with it some more.
hedgefundofone 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
EnterLongStop flaviufechete Strategy Development 13 08-13-2007 02:18 AM


All times are GMT -6. The time now is 02:50 PM.