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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
548 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment