if (Close[0] > Close[10]) { EnterLong(DefaultQuantity, "Long"); }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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?
Code: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 Rapine Heihei, Today, 08:19 PM
|
0 responses
1 view
0 likes
|
Last Post Today, 08:19 PM | ||
Started by f.saeidi, Today, 08:01 PM
|
1 response
4 views
0 likes
|
Last Post Today, 08:17 PM | ||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, Today, 07:51 PM
|
0 responses
4 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
5 responses
96 views
1 like
|
Last Post
by caryc123
Today, 07:47 PM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
6 responses
49 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
Comment