![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2009
Posts: 220
Thanks: 0
Thanked 0 times in 0 posts
|
I am backtesting a strategy on daily charts, whereby the entry would be on market close on the same day the signal is generated and the exit would be on the close of the next day.
However, during backtesting, the entry is on next day open and exit is on the day after next open, which are 1 day late. How do I change the code such that it enter and exit the way I want it as describe in the first instance? Else my backtest results will be incorrect. Thanks. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Hi tjendra, you would need to add a finer datastream for execution then to your daily chart. This reference sample will demonstrate how to achieve this - http://www.ninjatrader-support2.com/...ead.php?t=6652
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Mar 2009
Posts: 220
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
I attached the graph which showed the intrabar entry and exit and also the output and source code of the strategy. The entry and exit shown on the graph is on the wrong bar and also doesn't tally with the output of the strategy. |
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Hi Tjendra, the code looks ok, with the faster series as the secondary to submit the orders to. I guess you're probably wondering about the display as the entry is displayed at the next bar but at the correct price from the last daily close. You can add a Print statement like
Code:
Print(Time[0].ToString())
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to enter long/short on close of a candle? | pbastowski | Automated Trading | 1 | 02-26-2009 02:59 PM |
| Exit on close | starrynight | Automated Trading | 12 | 01-15-2009 05:59 AM |
| Exit On Close | TraderGuy | Strategy Development | 15 | 01-07-2009 02:10 AM |
| Possible to enter/exit during the day with a daily strategy? | cunparis | Strategy Development | 2 | 11-01-2008 02:58 AM |
| How to enter market on close order? | cunparis | Strategy Development | 1 | 10-06-2008 08:17 AM |