if (Close[0] > Close[10])
{
EnterLong(DefaultQuantity, "Long");
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Buy on the close
Collapse
X
-
Buy on the close
I know this usually cannot be done but I would like to backtest my code with entries on the close of present bar where signal is generated rather than on the open of the next daily bar. How can I modify the entry below to have the order placed at the close?
ThanksCode:Last edited by ricko; 10-10-2015, 10:54 AM.Tags: None
-
Hello Ricko,
Thank you for writing in. Please see the following reference sample for how you can go about accomplishing this: http://ninjatrader.com/support/forum...ead.php?t=6652
Please let me know if you have any questions or if I may be of further assistance.Michael M.NinjaTrader Quality Assurance
-
Hello ricko,
Unfortunately this is not possible in the way you are describing. You can enter prior to the close of the current bar but to do this requires your strategy to calculate intrabar.
For a realtime strategy in NinjaTrader 7, you could simply set CalculateOnBarClose equal to false and create conditions to determine when to actually enter based on the period of the data series you were using. This approach would also work for a backtestable strategy in NinjaTrader 8 due to the added feature of Tick Replay.
To accomplish this in a backtestable strategy in NinjaTrader 7, you will have to add a secondary data series and I have provided an example of this in my earlier post.
Please let me know if you have any questions or if I may be of further assistance.Michael M.NinjaTrader Quality Assurance
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
161 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
309 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
245 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
349 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment