And yes, I am definitely on Beta 19.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Closes[1]
Collapse
X
-
This has your line commented out in order to test the alternate encapsulation.
And yes, I am definitely on Beta 19.
-
Comment
-
If the change in this last Test_MultipleBars is not what you mean, please change it to show me what you mean... because we are not communicating.
In other words, how to write it so that the plot of TEST(1) on the 1st series == the Test(0) on the second ?
Thank you.
Comment
-
Here's the changed OnBarUpdate(), please try plotting always from the primary series -
You can then still toggle which BarsArray data to access with the X input you created, but print from BIP 0.Code:protectedoverridevoid OnBarUpdate() { if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return; if (BarsInProgress == 0) { if (CurrentBars[x] < 10) Value.Set(Inputs[x][0]); else { Value.Set( WMA( Inputs[x], 10 )[0] ); } } if (BarsInProgress == 0) Value.Set( Value[0] ); }
Comment
-
Did you leave the 2nd instance of if (BarsInProgress == 0) at the bottom in there by accident?
It seems contrary to every other sample I've seen for multi-bar code, but the results are closer. Can't say I care for the stair-step -- plotting from the BIP1 logically should have avoided that & made a plot identical to the bottom panel.
Thank you, I'll take this back to see if it works.
I do suggest that the development fix the plotting from BIP1 ...Last edited by Lost Trader; 07-30-2010, 04:27 PM.
Comment
-
Lost Trader,
It does indeed seem to be a typo from Bertrand. Please ignore that extra if(BarsInProgress == 0).
Plotting from a different BIP is not supported because the concept simply does not work. Everything that is visualized on a chart is tied to the bars of the chart. There are a set number of "slots" for a data value. For example if all of a sudden you wanted to plot from a BIP that had more bars than "slot"s available it would not make sense anymore as it would have no idea where to place the extra plot values you wanted to see. Basically a plot only has the same number of data points as the series it is applied to. Charting wise would not make much sense with any other amount of data points.
The stair-step happens as you try to plot values from a different BIP that is of a series with a longer period. This would be expected since that longer period would not update with as many values as their are plot values so you end up with redundant values for several plotted bars thus stair steps.Josh P.NinjaTrader Customer Service
Comment
-
Josh, this will bite y'all sooner or later. You may want to start wrapping your head around it, because it is possible, certainly when the second series is an even multiple of the first.
Bertrand's example says run all the code for the indicator when BIP=0 even when the indicator MUST be calculated on BIP=1. So, for example, how does code know when "FirstTickOfBar" is true for BIP=1 when it is forced to run only when BIP=0?
Comment
-
Test2(1) on BIP0 == Test2(0) on BIP1 ( Not ! )
OK, I expanded Test into Test2 with a more complicated calculation to get closer to where we ultimately need to be. Instead of a simple MA, this is a triple smoothed calculation... However the fixes used on the simple Test do NOT work on Test2.
So now how do we write it so that the plot of TEST2(1) on the 1st series == plot on the TEST2(0) on the second? Help, please ?
Comment
-
Excuse me? The first two lines on OnBarUpdate() areOriginally posted by NinjaTrader_Josh View PostYou really should filter your strategy logic to be within BIP0 context. Your code right now processes both BIP0 and BIP1. This is not recommended especially for plot setting.
This is EXACTLY what Bertrand said to do...Code:if (CurrentBars[0] < 0 || CurrentBars[1] < 0 || Bars == null) return; // patch for NT design flaw if (BarsInProgress != 0) return; // NT can only plot from BIP=0
The code below is definitely NOT processing BIP=1 bars, since 1 does not equal 0.
It is explicitly referencing Closes[x=1] for the calculations on BIP=0 bars exactly as y'all said to do.
Please try to explain again.
Comment
-
I see. So what is the issue then? Please be specific as to why you feel it is wrong.
Remember it is important to know when exactly each BIP event is updated. Processing a BIP0 event would happen before processing a BIP1 event. This means depending on your actual series used and at what point in time, accessing BIP1 could be still on the "prior" value. I put "prior" in quotes because it only appears to be the prior value for BIP1 in relation to BIP0, but it really is still the "current" value for BIP1 as the BIP1 has not updated yet.
Please see this Figure 1 in the "How Bar Data is Referenced" section here:
Let us assume you are on bar #6, the first cyan bar. BIP0 = 1min, BIP1 = 3min. Trying to access BIP1 from BIP0 on bar #6 would yield the value of the yellow bar because BIP1 has not happened yet. BIP1 only occurs when all three 1min bars are complete because it contains all information for all 3 bars. Trying to access it earlier would not yield a bar building in progress. You would get the latest available data which in this case would be the yellow 3min bar.Josh P.NinjaTrader Customer Service
Comment
-
Edit: OK, I was an idiot and used 225 instead of 125 when writing this post. 25*5 is 125 and the rest of the post still applies (The 125 still doesn't come close to 25*5).
From the beginning (I'll try to use short sentences): NT7 claims to support multi-bar indicators.
To test this, I wrote a simple indicator indicator that adds a second bar series using a chart setting that is a multiple of the underlying original chart.
This Test indicator plotted a calculation using Closes[x] where x is an input.
The first Test was a WMA, nothing fancy. A 10 period WMA on a 225 Volume chart should look like a 10 period WMA on a 25*5 Volume chart. It took a few rounds with Bertrand to get it working, And yes, it required that plotting be restricted to only when BIP=0.
Test2 is a triple smoothed calculation, but the principle is the same. The plot on a 225 Volume chart should look like the plot on a 25*5 Volume chart. Now look at the picture. The Test2 on 25V with BIP=1 (i.e., 25*5) should look like Test2 on 225V with BIP=0.
It doesn't even come close!
Yes, bar closes are different values sometimes. Once out of the multiplier used, they will be the same (e.g., 1/5). And with CalculateOnBarClose=false, both bar series will get the exact same number of ticks with the same price. They'd better!
I uploaded the Test2 indicator for support. Just as the first Test required some unexpected code and restrictions to work, I expect Test2 will as well. That is IF Ninjatrader does really support multi-bar indicators in NT7.Last edited by Lost Trader; 08-03-2010, 01:29 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
608 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
355 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment