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):
To find the average of integers in C#, use the Queryable Average() method.Let’s say the following is our integer array.var arr = new int[] { 10, 17, 25, 30, 40, 55, 60, 70 };Now, use the Av
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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
142 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
81 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
125 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
119 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
98 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment