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 just started trying to learn how to program yesterday, but I'm having a really difficult go at it.
I was attempting to divide the volume output by seconds per bar for use with Tick, Range and Renko type charts, but I really have no idea what I'm doing. I've been working on it and watching videos and reading the help menu for hours and hours, but I'm getting pretty stuck now. I have looked at other indicators and taken a few ideas from a few, but it's just not working. Would anyone be willing to help me out with this? I would really appreciate it. My retarded code is attached. I'm sure it's laughable, at best.
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.
Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.
I added "private double totalseconds; under variables. Did I at least get that right? Probably not. Please forgive my ignorance.
Re: "your indicator will not display correctly for the first bar of each session..." I deleted the "If current bar < 1 return..." lines under OnBarUpdate. Was that what I should have done to address this problem? I suppose it's obvious I have no idea what I'm doing here, and that's fine. I just have to keep working at it and asking for help if I'm going to learn how to do this.
Also, under properties, is that all I need in that section?
Thank you so very much for your help; I really appreciate it
Just a couple of questions left now: Bertrand used int instead of double. What are your thoughts on that? And how do I make it display correctly for the first bar of each session and for the first bar after a technical break? I don't really understand what I could possibly do here.
timer.TotalSeconds returns a double value. There is no need to convert it to int, because you will use it as divisor for Volume[0], which itself contains a double value.
first bar of session:
Check for Bars.FirstBarOfSession with every bar. In case that you have a first bar of the session, you do not calculate timer = Time[0] - Time[1], but timer = Time[0] - sessionBegin. You can find out the sessionBegin via Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd), where sessionBegin and sessionEnd are DateTime objects.