NexusFi: Find Your Edge


Home Menu

 





Hybrid Custom BarType


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MWinfrey with 9 posts (3 thanks)
    2. looks_two aslan with 6 posts (5 thanks)
    3. looks_3 RJay with 2 posts (0 thanks)
    4. looks_4 dalebru with 1 posts (0 thanks)
    1. trending_up 6,611 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 18 posts
    2. attach_file 1 attachments




 
Search this Thread

Hybrid Custom BarType

  #1 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335

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.

Mike Winfrey

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
44 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127



JoeBlow View Post
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).

Reply With Quote
Thanked by:
  #4 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 682 since Jun 2009
Thanks Given: 757
Thanks Received: 787


JoeBlow View Post
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.

Mike Winfrey

Hi Mike,

Not having the output window when working on custom bartype files really sucks!!!

Aslan has a workaround. I just had to settle for brain damage from banging my head against the wall.

I agree with the outline Aslan has provided in his post on initial steps for the new bartype.

I did try to visualize what the chart would look like. Is this something new or are you trying to duplicate something you have seen?

If you are interested in a tutorial from my experiences in chart type development, contact me.

RJay

Reply With Quote
  #5 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335

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.

Thanks again aslan...have a great day.

Started this thread Reply With Quote
  #6 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335

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 think that about covers it.

Thanks again for your post.

Mike

Started this thread Reply With Quote
  #7 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

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.

Reply With Quote
  #8 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 682 since Jun 2009
Thanks Given: 757
Thanks Received: 787

Hi Mike,

You said:

"I have 3 charts to help me with that, a 1 minute chart, 400v chart, and 4 tick renko brick chart."


I believe:

Range, time, and volume charts can be compatible because of the way they are constructed.

Renko is a completely different animal. Trying to merge it with other chart types would be "difficult".
Good Luck,

RJay

Reply With Quote
  #9 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127


RJay View Post
Renko is a completely different animal. Trying to merge it with other chart types would be "difficult".

I agree. I saw a new Renko indicator in the downloads section: RBI

See if that may be of help.

Reply With Quote
  #10 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


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.

Thanks again.

Started this thread Reply With Quote




Last Updated on September 17, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts