Set on every single bar. Take it one step at a time. I suggest you work with regular DataSeries and see how it works. When you do not set a value, the DataSeries will autopopulate with the close price so a zero is not coming from auto population. It is coming from either a Set or a Reset.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Number of elements in data series
Collapse
X
-
gg80108,
Set on every single bar. Take it one step at a time. I suggest you work with regular DataSeries and see how it works. When you do not set a value, the DataSeries will autopopulate with the close price so a zero is not coming from auto population. It is coming from either a Set or a Reset.Josh P.NinjaTrader Customer Service
-
I have simplified your code and it is very clear why you receive zeroes. This is why I asked you to Print the values of the calculations before each set. It is very clear from the first screenshot that the values you are receiving come from a calculated zero as the math makes it zero. You are subtracting the current PnL total from the PnL stored for the prior session. As you start a new session you have not made any trades yet so the current PnL is still the same as the stored one from yesterday. This means you get zero. You will continue to get zero until you successfully make a trade for the new session.Josh P.NinjaTrader Customer Service
Comment
-
gg80108,
Please take a look at the reference I just posted in my previous post. Disregard auto fill. It is evident now that you receive zeroes from not having any trades on the new session. You will notice that you only get these zeroes as you switch to a new session and have not completed any new trades yet.Josh P.NinjaTrader Customer Service
Comment
-
I experimented with your sampleCustomDataSeries,, I commented out the SET and printed the results . Just isnt the close of the bar but just random and if you round it off it becomes 0..
/* Take note that the method for setting the value to be plotted is the same as for setting a value
to a DataSeries object. The difference here is that the custom DataSeries object is not plotted while
this "AvgR" is plotted.
In this case we are plotting the Simple Moving Average of the intermediate calculation step stored in our
DataSeries object. */
// AvgR.Set(SMA(myDataSeries, Period)[0]);
Print ("myDataSeries value: "+ myDataSeries[0] + " bar # " +Bars.BarsSinceSession);
Output window
myDataSeries value: 0.299999999999955 bar # 7
myDataSeries value: 0.399999999999977 bar # 8
myDataSeries value: 0.399999999999977 bar # 9
myDataSeries value: 0 bar # 10
myDataSeries value: 0 bar # 11
myDataSeries value: 0 bar # 12
myDataSeries value: 0.399999999999977 bar # 13
myDataSeries value: 0.199999999999989 bar # 14
myDataSeries value: 0.399999999999977 bar # 15
myDataSeries value: 0.300000000000011 bar # 16
myDataSeries value: 0.399999999999977 bar # 17
myDataSeries value: 0.300000000000011 bar # 18
myDataSeries value: 0.399999999999977 bar # 19
myDataSeries value: 0.399999999999977 bar # 20
myDataSeries value: 0.399999999999977 bar # 21
myDataSeries value: 0.300000000000011 bar # 22
myDataSeries value: 0.399999999999977 bar # 23
myDataSeries value: 0.399999999999977 bar # 24
myDataSeries value: 0.399999999999977 bar # 25
myDataSeries value: 5.6843418860808E-14 bar # 26
myDataSeries value: 0.0999999999999659 bar # 27
myDataSeries value: 0.299999999999955 bar # 28
myDataSeries value: 0.399999999999977 bar # 29
myDataSeries value: 0.399999999999977 bar # 30
myDataSeries value: 0.0999999999999659 bar # 31
myDataSeries value: 0.399999999999977 bar # 32
myDataSeries value: 0.399999999999977 bar # 33Last edited by gg80108; 04-20-2009, 09:43 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment