Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Understanding Multi-series Processing
Collapse
X
-
Hello Brillo,
Thanks for your note.
This would depend on the exact code in the script.
If BarsInProgress is 5, then there must be at least 6 data series (including the primary which is BarsInProgress 0).
Anytime you limit code to processing while a specific BarsInProgress is updating, that code will only trigger when the bar closes for that specific data series.
For example, if on my chart I have a 1 minute series.
In Initialize() I add:
Add(PeriodType.Tick, 1);
Add(PeriodType.Day, 1);
This makes for three series:
BarsInProgress 0 is the primary series of 1 minute
BarsInProgress 1 is the 1 tick series
BarsInProgress 2 is the day series.
If in OnBarUpdate() I write:
if (BarsInProgress == 0)
{
Print(string.Format("{0} | Executes on each minute", Times[0][0] ));
EnterLong(0, 1, "entry);
// EnterLong(int barsInProgressIndex, int quantity, string signalName)
}
This will update on each minute, when it places an order, that order will fill with prices from the minute series. This means the order will fill with the open price of the next minute bar.
If in OnBarUpdate() I write:
if (BarsInProgress == 0)
{
Print(string.Format("{0} | Executes on each minute", Times[0][0] ));
EnterLong(1, 1, "entry);
// EnterLong(int barsInProgressIndex, int quantity, string signalName)
}
This will update each minute, the entry will use fill prices from the 1 tick series. This means the order will fill with the next tick price.
If in OnBarUpdate() I write:
if (BarsInProgress == 1)
{
Print(string.Format("{0} | Executes on each tick", Times[0][0] ));
EnterLong(2, 1, "entry);
// EnterLong(int barsInProgressIndex, int quantity, string signalName)
}
This will update on each tick, the entry will use fill prices from the daily series. Meaning the order will fill with the next daily bars open price.
I've made an example that prints the output window and allows the BarInProgress the order is being placed to to change. This is so you can compare the fill price of the order and match this with the BarsInProgress for the data series that was used to fill the order.
That said, changing the BarsInProgress for the logic or for the order entry will drastically change the results as this changes either when code is being triggered or changes the fill price and time of the orders being placed.Attached FilesChelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by futtrader, 04-21-2024, 01:50 AM
|
4 responses
41 views
0 likes
|
Last Post
by futtrader
Today, 03:01 PM
|
||
Can someone turn this thinkscript into a ninjascript. 5PM CST OHL and Previous Day
by Option Whisperer
Started by Option Whisperer, Today, 09:55 AM
|
1 response
11 views
0 likes
|
Last Post
by bltdavid
Today, 02:44 PM
|
||
Started by port119, Today, 02:43 PM
|
0 responses
3 views
0 likes
|
Last Post
by port119
Today, 02:43 PM
|
||
Started by Philippe56140, Today, 02:35 PM
|
0 responses
4 views
0 likes
|
Last Post Today, 02:35 PM | ||
Started by 00nevest, Today, 02:27 PM
|
0 responses
2 views
0 likes
|
Last Post
by 00nevest
Today, 02:27 PM
|
Comment