Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OrderFlowCumulativeDelta Issue
Collapse
X
-
OrderFlowCumulativeDelta Issue
I am creating an indicator that is referencing the OrderFlowCumulativeDelta indicator and I'm having an issue accessing the correct values. I've attached a sample indicator that will show the issue. Why is my sample indicator plotting different values than the OrderFlowCumulativeDelta indicator?
Tags: None
-
Hello SystemTrading,
Thanks for your post.
I see in the screenshot you shared that the Order Flow Cumulative Delta indicator is set to use Bar for the Period property.
In the code you shared, you are using CumulativeDeltaPeriod.Session, not CumulativeDeltaPeriod.Bar.
cumulativeDelta = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAs k, CumulativeDeltaPeriod.Session, 0);
You should change the 'Period' property of the Order Flow Cumulative Delta indicator to 'Bar' instead of 'Session' to compare your indicator to the Order Flow Cumulative Delta indicator.
When comparing your custom indicator to the Order Flow Cumulative Delta indicator that comes with NinjaTrader, make sure that you are using the exact same settings in the Order Flow Cumulative Delta indicator as you are using in your custom script.
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Good catch. However, I am still having an issue beyond that. I've attached code for two indicators named TestA and TestB. The TestA indicator is referencing the OrderFlowCumulativeVolume indicator, and the TestB indicator is referencing the TestA indicator. Historically, the plots match as I would expect. However, they do not match in real-time.
I added some print statements to help determine what is happening. In the window below, the lines labeled "Chart Indicator" are being printed by the instance of the TestA indicator that is visible on the chart. The lines labeled "Signal Indicator" are being printed by the instance of the TestA indicator that is being referenced by indicator TestB (i.e. it is not visible on the chart). As you can see, the delta values being returned to the two instances are different. Why would this be?
Comment
-
Hello SystemTrading,
Thanks for your notes.
When testing the indicator script you shared, TestA and TestB, on a 1-Minute ES 09-23 chart I am seeing that the indicator plots do match when running on real-time data.
See this demonstration video showing that the TestA indicator plots and TestB indicator plots match up: https://brandonh-ninjatrader.tinytak...NV8yMTgzODExMQ
I suggest opening a new blank chart and adding those indicators to the blank chart window to retest the indicator scripts you shared to see if the plots match.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
What about your output window? Did the values match? I've updated my example to better reflect the issue.Attached FilesLast edited by SystemTrading; 07-31-2023, 09:23 AM.
Comment
-
Hello SystemTrading,
Thanks for sharing that updated sample script.
In the TestB indicator script, you would need to call .Update() on ind in BarsInProgress 1 to update the secondary series of the cached indicator to make sure the values you get in BarsInProgress == 0 are in sync. This is similar to how you are updating cumulativeDelta in the TestA indicator script.
For example:
Code:if (BarsInProgress == 1) ind.Update(ind.BarsArray[1].Count-1, 1); else Values[0][0] = ind.Values[0][0];
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
- Likes 1
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by giulyko00, Today, 05:30 AM
|
0 responses
4 views
0 likes
|
Last Post
![]()
by giulyko00
Today, 05:30 AM
|
||
Started by globaljobber, Today, 05:26 AM
|
0 responses
3 views
0 likes
|
Last Post
![]()
by globaljobber
Today, 05:26 AM
|
||
Started by totalnewbie, Today, 04:45 AM
|
0 responses
8 views
0 likes
|
Last Post
![]()
by totalnewbie
Today, 04:45 AM
|
||
Started by Skifree, Today, 01:35 AM
|
0 responses
10 views
0 likes
|
Last Post
![]()
by Skifree
Today, 01:35 AM
|
||
Started by somanko, Yesterday, 11:51 AM
|
3 responses
25 views
0 likes
|
Last Post
![]()
by somanko
Today, 01:24 AM
|
Comment