Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm advancing my understanding of C# - currently going through C#2008 For Dummies.
I'm attempting to see what the hourly or daily range (or whatever variable time I want) is over a certain quantity of bars so I can apply a moving average and review other statistics. I've finally figured out how to get a barcount for the session using the following(in the OnBarUpdate section):
Now, i'm trying to use this barcount with the range per bar and I'm not sure how to use this barcount with the following or similar to get the array and average range.
Eventually, I'm going to attempt getting statistics with results similar to the following:
(these are examples only!)
1. for CL, the average daily range is 52 ticks
2. for CL on Tuesday during 9am-10am, the average hourly range is 35 ticks
3. for CL on Tuesday during 11am-12am, the average hourly range is 7 ticks
I know I need some "data holders" such that the range data gets plugged into the right location - "like colored marbles in the correct sack"
any help or direction anyone could give is much appreciated. Any code snippets would be welcome.
thanks,
Kirk
Can you help answer these questions from other members on NexusFi?
Then you can pass that dataseries to your indicator, like if you want an SMA of the high low, it would be
double _smahl = SMA(hl, 10)[0];
If you are trying to get the range of a period of bars, try using HighestBar and LowestBar, it returns the bar number within a certain period that was the Highest or Lowest. Then you can use that Bar # and lookback at it for more info, like:
double _highestbar = HighestBar(10);
Print(Time[0] + ": the highest bar was " + _highestbar + " bars ago, with a value of " + High[_highestbar]);
You can also use MIN and MAX, but be careful using them over large dataseries, they are a real performance drag.
If you want to limit your lookback period to just today, use Bars.BarsSinceSession.
Ok either you added some new stuff to your post or I missed the bottom part before I replied. Probably my bad, been a rough week for me
For ATR stuff, you can do a few things. First if you can't use a real daily chart, you can use a 1440m chart. But I would focus on just the cash session if it were me, so I would treat your "daily" request similar to your 9am-10am request and be specific with the time frame, instead of using a 24 hour clock.
Time[0] is your friend. Just use it to figure out what time it is. That way one script can handle multiple requests, like the 'daily' request, the 9am-10am, etc.
GetBar() is your friend, too. You can tell it to look at a specific time frame. This will help you narrow down what bar has happened at 9am, and what bar number ended at 10am. Then use those two bar numbers and a combination of MIN or MAX, or even HighestBar or LowestBar depending on when you're calling them, to get your high and low range.
Sorry, no time to give you more than this right now.
that's okay,
yes i thought there were a couple points you didn't address in that first post.
hope your week is better (and mine too - didn't even get to open NT today - having a withdrawal or tantrum lol)
the only reason i'm using daily now is so i can easily count the bars in the group, then, i'll start enlarging the pool and explore other details
I appreciate about the Bars.Count. The setup of an array with the possible plot to a screen text grid is where i'm eventually headed.
There's some value in getting the current picture of where we are in relation to a "normal" day. ie on high-end of the typical range, on a low-range or narrow day, within 5 ticks of the bottom of the range and below the open, etc. there's a screenshot of some data coming back to the chart to update in realtime.