Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to do math on Array elements?
Collapse
X
-
How to do math on Array elements?
I made an Array called myRangeArray[47] with 48 slots- one for each 30 minute TPO time period. I used Date.Time conditionals to store range values for 1/2 hour bars ending at 1:30am 013000 in myRangeArray[2] slot 2 for example. So i have right data in right place. But my question is how can i take the average of all numbers in slot [2]? How can 2 std deviation be calced? In short, how can a person do math on the list of doubles in a slot? thanks!Last edited by Kicks.Spin; 01-07-2022, 08:16 AM.Tags: None
-
Hi Kicks.Spin, thanks for posting.
I found several links through a google search on taking the average of a C# array here (publicly available):
The Average() method in C# calculates the arithmetic mean of a sequence of numeric values. This method is part of LINQ (Language Integrated Query) and can be used with arrays, lists, and other enumerable collections.
Kind regards,
-ChrisL
-
I don't fully understand what you're doing but, I recommend this library which I use a lot:
might be what you needCode:Statistics.Mean(slot[2]) Statistics.PopulationStandardDeviation(slot[2]) * 2
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
175 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
331 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
253 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
356 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
183 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment