Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
order renko backtesting
Collapse
X
-
Hello bergimax,
Thanks for your note.
This is due to CalculateOnBarClose being true. OnBarUpdate will only be called as a new bar forms. This means that while your order may be accepted intrabar, it will not show on the chart until the next bar.
To show orders on the same bar, set the strategy parameter CalculateOnBarClose to false.
Right-click the chart -> select Strategies...
In the parameters on the right set CalculateOnBarClose to false.
This will only work for orders in real time data and not historical. A strategy will always use CalculateOnBarClose true for processing historical data.
Below is a link to the help guide on CalculateOnBarClose.
http://www.ninjatrader.com/support/h...onbarclose.htm
Please let me know if this does not resolve your inquiry.Chelsea B.NinjaTrader Customer Service
-
Hello bergimax,
Because you are backtesting, CalculateOnBarClose is true and cannot be changed.
If you would like to do intrabar orders, you can add a second data series with a smaller interval and use the logic for that data series.
To add a tick interval to your chart use the Add() method.
For example, add to the Initialize():
Add(PeriodType.Tick, 1);
And in OnBarUpdate():
if (BarsInProgress == 1)
{
if (Postion.MarketPosition == MarketPosition.Flat && SMA(19)[0] > Closes[1][0])
{
EnterLongLimit(0, true, 1, Highs[0][0], "long1");
}
}
This will use the second data series, the tick series to check to see if the SMA[0] is higher than Close[0]. This means it will be checking every tick to see if the SMA is higher than the close of the tick series. Then it places the order using the primary data series (45 min or whatever the chart is). This means that the limit order will fill once the 45 minute series has the close price hit the limit price. This will mean it will be at least until the next 45 minute bar before the order is placed.
Please let me know if this is not helpful to you.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello bergimax,
I would like to continue assisting you with your script. If you would like, you can send me the script and I will test it.
Please let me know exactly how it performs in backtesting vs live testing and how you would like it to be different.
Then create an export of the script and attach this to your reply.
If you would like to keep your script private between you and me, send the script to support[at]ninjatrader[dot]com with Attn Chelsea: # 851421 written in the body.
To export your script do the following:
1. Click File -> Utilities -> Export NinjaScript
2. Enter a unique name for the file in the value for 'File name:'
3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
By default your exported file will be in the following location:
* (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>
Below is a link to the help guide on Exporting NinjaScripts.
http://www.ninjatrader.com/support/h...nt7/export.htm
I look forward to your reply.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by yertle, Yesterday, 08:38 AM
|
7 responses
28 views
0 likes
|
Last Post
by yertle
Today, 12:15 AM
|
||
Started by bmartz, 03-12-2024, 06:12 AM
|
2 responses
21 views
0 likes
|
Last Post
by bmartz
Today, 12:11 AM
|
||
Started by funk10101, Today, 12:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by funk10101
Today, 12:02 AM
|
||
Started by gravdigaz6, Yesterday, 11:40 PM
|
1 response
9 views
0 likes
|
Last Post Yesterday, 11:49 PM | ||
Started by MarianApalaghiei, Yesterday, 10:49 PM
|
3 responses
11 views
0 likes
|
Last Post Yesterday, 11:33 PM |
Comment