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've done a lot of NT 6.5 programming of indicators and strategies but am running into a challenge that I haven't been able to solve. I am trying to create a hybrid custom bartype that consists of time, volume, and the open to close range. For example, I want to set the time to 1 minute, open to close range of the bar to 4 ticks, and the volume to 400v. This combines the value of all 3 types of bars. A new bar will be started when either of those parameters is met. this prevents huge bars when you are using 1 minute or 400v charts. However, it also prevents a single bar taking forever to close when you are using 400v or 4 tick range bars or 4 tick renko bars. My belief is that by combining all 3 factors, you have a more accurate representation of volatility than either of the conventional bars provide.
Any thoughts on the value of this type of bar and also is there anyone interested in helping me code this as a custom bar type?
Also, I'm curious how to output or print somthing to the output window from within a custom bartype. Print() doesn't work. I get an error saying Print() isn't found within this context.
Yes, Print() is not available when building bars. I assume you are trying to debug your code, in which case I usually just open a text file and write to that instead of the output window (search for StreamWriter in C#). There is a thread around here on debugging indicators in Visual Studio, not sure if that would work for bar building code, but it may be worth looking into.
I dont use 6.5 anymore, but can try to answer some questions on bar building. Most of your code will be in the Add() method. Use the NT Range, Volume, and Minute Bar code as a base to see how they close bars (don't take their code as gospel though, as their is a lot of stupid stuff in there). Pick one of those types as the base and save it with the name of your bar type. I usually save the code in the indicator directory, so you can edit and compile the code as if it were an indicator (just remember, you need to restart NT to reload the bar type code after you compile it).
Thanks aslan...I've done some custom bar building before as well and worked out the outline for that in the same fashion you describe. I started with the volume bartype and have MikesVolume working just fine. I save to the indicator directory as well. Just easier to get to. And yes I restart NT each time. Took a bit to figure that out.
Regarding Print()...yes I'm trying to debug my code. I thought of streamwriter yesterday after posting my message but figured I'd wait to see what kind of responses I get. Now I think I'll get back on that after I get back from seeing the doctor.
Now I can attempt to figure out why my code isn't working like I think it should.
Hello RJay and thanks for your reply. Let me answer your question like this. I've never seen anything like what I describe so from my limited point of view, it's new. My challenge prior to entering a trade is to identify when the conditions are right. How's that for an statement of the obvious. I know there are other ways to look at it but anyway. For the purposes of my task, that's the way I see it. I see the market as having 3 aspects that need to be evaluated; time, volume, and range. I have 3 charts to help me with that, a 1 minute chart, 400v chart, and 4 tick renko brick chart. I actually trade on the renko chart. Really love those little fellas. However, each of those chart only account for one of the aspects in an obvious way. Time can be evaluated on each of those but it requires brain cells and I don't have many left at this stage of life. Using the 1 minute and 400v charts can get you to the party very late because of the big bars that can happen. Anyway, I've thought for some time now that it would be nice if I had a bar that was constructed accounting for all 3 aspects. I've visualized what that chart will look like and I think it might be useful but like all things I do, I don't really know until I actually see it.
I know you are using 6.5, but I thought I would mention one thing for NT7. In NT7, they added bar caching to try to improve performance (which they do), but they make writing custom bars difficult for several reasons. First, once they are cached, you can not depend on getting Add() called for Bar zero, so there is no good place to do time zero initialization. Second, when debugging, you will get strange inputs and bars will not be rebuilt, but loaded from the cache. The only way around this is to blow away the cached bars on disk. Just something to remember if/when you do make the jump.
oh gee...I've run into that. I do have nt7 up on a third computer for testing and see that my version of the renko bar has some issues. probably related to your comment. I'll take a look with your comments in mind.