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
Sync Multiple Time Frames
Collapse
X
-
Hello sdauteuil, thanks for your reply.
We use the ELSE clause when we want something to happen if the previous condition was explicitly false. The ELSE part will only be evaluated if the above IF is false. In this case you would want to use
if (BarsInProgress == 1)
cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
if (BarsInProgress != 0)
return;
Please let me know if I may provide any further information.
-
Which is the proper use of if and else if in this instance? Use If and else if OR Use 2 if statements
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
if (BarsInProgress != 0)
return;
if ((CurrentBars[0] < 20)
|| (CurrentBars[1] < 20)
|| (CurrentBars[2] < 20))
return;
// Rest of Code
OR
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
else if (BarsInProgress != 0)
return;
if ((CurrentBars[0] < 20)
|| (CurrentBars[1] < 20)
|| (CurrentBars[2] < 20))
return;
// Rest of Code
Leave a comment:
-
Hello sdauteuil,
In real time is it possible to have the primary bar / time frame operate under OnBarUpdate()
and have the additional time frame (3 minute in this case) operate OnEachTick.
Basically if I am using OnBarUpdate can I access the current / real time value of the other time series?
https://ninjatrader.com/support/help...FirstTickOfBar
Also I currently do not have the code to sync the 1 tick time frame for cumulative delta.
Should I add this (code below) under State == State.DataLoaded?
Please let me know if I may be of additional assistance.
Leave a comment:
-
Also I currently do not have the code to sync the 1 tick time frame for cumulative delta.
Should I add this (code below) under State == State.DataLoaded?
else if (BarsInProgress == 1)
{
// We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
}
Leave a comment:
-
In real time is it possible to have the primary bar / time frame operate under OnBarUpdate()
and have the additional time frame (3 minute in this case) operate OnEachTick.
Basically if I am using OnBarUpdate can I access the current / real time value of the other time series?
Leave a comment:
-
Hello sdauteuil,
From the description that sounds correct, when using 0 bars ago that would return the last closed bars value. Depending on what series called the Closes[2][0] that would return the last closed 3 minute bar at that time in processing. Only if you are in Realtime and using OnEachTick calculation would the Closes[2][0] represent that series last price.
The other logic you have shown is needed specifically for the CumulativeDelta indicator because that is required for it to work, that is not something you would need when adding other series or using other indicators.
Please let me know if I may be of additional assistance.
Leave a comment:
-
Sync Multiple Time Frames
What is the proper way to synchronize multiple time frames in a strategy and return the current value of additional time series?
I have a strategy using cumulative delta which requires a secondary 1 tick time frame and I have an additional 3 minute time frame...
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Tick, 1);
AddDataSeries(Data.BarsPeriodType.Minute, 3);
}
I need to synchronize them. Part of the logic is the current close is higher than the open of the 3 minute bar. (for longs)
(Closes[2][0] > Opens[2][0])
It looks like the values of the previous 3 minute candles are being returned not the current.
I see under help guide cumulative delta instructions on syncing the 1 tick time frame.
else if (BarsInProgress == 1)
{
// We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
}
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by FrazMann, Today, 11:21 AM
|
2 responses
6 views
0 likes
|
Last Post Today, 12:38 PM | ||
Started by rjbtrade1, 11-30-2023, 04:38 PM
|
2 responses
80 views
0 likes
|
Last Post
by DavidHP
Today, 08:12 AM
|
||
Started by Spiderbird, Today, 12:15 PM
|
1 response
7 views
0 likes
|
Last Post Today, 12:34 PM | ||
Started by lorem, Yesterday, 09:18 AM
|
5 responses
18 views
0 likes
|
Last Post Today, 12:29 PM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
12 responses
42 views
0 likes
|
Last Post Today, 12:09 PM |
Leave a comment: