![]() |
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EnterLongStop | flaviufechete | Strategy Development | 13 | 08-13-2007 02:18 AM |