![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
|
Hello:
I am using the above Sample Education Resource within my strategy, which adds a 1 minute secondary bar series to fill orders. The strategy enters the trade correctly, but exits the trade at the end of the day without hitting either the stop loss or profit target. I did replace my strategy code with an EMA crossover to see if my code was causing this problem, but I got the same result. Can you give me some hint on what direction to take to handle this problem? Thanks. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
You can change that in tools>options>Strategies>NinjaScript and uncheck the check box at the bottom.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
|
Hello:
Under "Order Handling", I unchecked the "cancel strategy orders on strategy termination" box and each existing order still exits on the close of the day the trade was entered. The "Stop and target submission" is currently set to "Per entry execution". Should it be set to "By strategy position"? Just grasping at straws. Thanks. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello Tonyh,
You can set "Exit on Close" to false whenever you apply the strategy. You can also declare this in code: ExitOnClose = false; http://www.ninjatrader-support.com/H...itOnClose.html
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
|
Hello Ryan:
This also doesn't work. If no other suggestions are available, I guess I will create a new strategy with my trading code and gradually add the SampleIntrabarBacktest code to see where the problem is. As I like the idea of trading on the 1 minute bar data. Thanks. |
|
|
|
|
|
#6 |
|
Member
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
|
Hello Ryan:
I kept the above code, added your change and added a small trading algorithm, and it works on a chart. However, when running the code on "Strategy Analyzer" it still exits at the close of each day. Is this code able to work in Strategy Analyzer? Thanks. |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
You can set this setting in the strategy analyzer. Select False on this setting when backtesting.
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 03-15-2010 at 11:38 AM.
Reason: replies crossed
|
|
|
|
|
|
#8 |
|
Member
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Ryan:
It works perfectly. I assumed that the ExitOnClose would be set to false with the code. I now fully know what "assume" means. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working with "Trade Class" on a day-by-day basis | AnotherTrader | Automated Trading | 2 | 01-22-2010 07:45 AM |
| Enter trade at open and exit trade at close | d.allen101 | Strategy Development | 3 | 11-11-2009 10:02 AM |
| Exit-on-close handling initiated after market close | tooearly | Automated Trading | 3 | 08-05-2009 08:07 AM |
| Enter at Close, Exit next day Close | tjendra | Strategy Development | 3 | 04-08-2009 11:33 AM |
| Possible to enter/exit during the day with a daily strategy? | cunparis | Strategy Development | 2 | 11-01-2008 02:58 AM |