Thanks!
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Quick Sort Possible for DataSeries Object?
Collapse
X
-
Quick Sort Possible for DataSeries Object?
Is it possible to embed the quick sort algo for a DataSeries object within the OnBarUpdate() method? I tried to do so (quick sort the volume[] object for all the data from the beginning of the trading day to the latest bar) but the compiled indicator always freezes upon loading. I'm wondering if the DataSeries object cannot be sorted as a regular array, and if there's any built-in sorting routines for DataSeries. I was using the standard C# quick sort algo. Nothing fancy here.
Thanks!Last edited by zenith1107; 05-29-2009, 02:48 AM.Tags: None
-
-
The thing is I want to sort the volume data dynamically - sort all the data from the beginning of the trading day to the current bar, sorting once upon each new bar. My goal is to find the value that divides the sorted volume data exactly in half then return that value (which is again updated upon each new bar). Is there a way to do the sorting within the volume[] object? I'm only saying this because transferring data from volume[] dataseries to a new array dynamically probably will take an enormous amount of memory. Intuition tells me that a quicksort routine followed by a while loop might do the job without creating a new custom array.
Comment
-
Hello,
I'm jumping the middle of this, but a loop with a mean or range/2 calculation to find the middle sounds like it will do what you want. Then you can update it on each tick (will use more resources), or update it on FirstTickOfBar to save resources.
If that didn't help, repost and Josh will help you on Monday.DenNinjaTrader Customer Service
Comment
-
Originally posted by zenith1107 View Post...I'm only saying this because transferring data from volume[] dataseries to a new array dynamically probably will take an enormous amount of memory. Intuition tells me that a quicksort routine followed by a while loop might do the job without creating a new custom array.
Regards
Ralph
Comment
-
Zenith107,
so you want to find the past bar when half of the current days volume has been traded? Do I understand correctly?
Why don't you use a Volume chart instead of a time chart?
For example set every chart bar to volume 1000
Then you know the total volume by multiplying the volume per bar by the number of bars elapsed.
And half the volume is simply half that number of bars back from current.
regards
Comment
-
hello all,
I also wanted to sort on volume as in the beginning of this thread. I would sort on FirstTickOfBar and would want to sort to find the highest, then second highest, then third highest and ... etc.
I found this:
"HighestBar(Volume, Bars.BarsSinceSession-1)"
but it only gives me the highest of the day as each new higher volume bar of the day comes along.
So what I want to know is if there is a way to sort past volume bars into a list of highest to lowest.
Thanks,
taddypole...
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by NRITV, Today, 01:15 PM
|
2 responses
6 views
0 likes
|
Last Post
by NRITV
Today, 01:51 PM
|
||
Started by frankthearm, Today, 09:08 AM
|
7 responses
30 views
0 likes
|
Last Post Today, 01:30 PM | ||
Started by maybeimnotrader, Yesterday, 05:46 PM
|
5 responses
25 views
0 likes
|
Last Post Today, 01:19 PM | ||
Started by quantismo, Yesterday, 05:13 PM
|
2 responses
18 views
0 likes
|
Last Post
by quantismo
Today, 01:07 PM
|
||
Started by adeelshahzad, Today, 03:54 AM
|
5 responses
33 views
0 likes
|
Last Post Today, 11:29 AM |
Comment