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,652 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

  #11 (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

Yes I understand that renko is a "different animal". I'm starting my quest using volume, time, and range. We'll see how that goes before I attempt to do anything with the "different animal". This may turn out to be an academic exercise but it sure looks awesome in my head along with all those other wonderful ideas just dying to get out.

Thanks again,

Mike

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #12 (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

aslan and RJay,

I've been working with the MinuteBarType and ran across something right at the outset that I'm not sure how to handle. I copied the code for the Minute Bar type into an indicator so I could replicate the MinuteBarType as MikesMinuteBarType. I changed all references to MinuteBarType to MikesMinuteBarType and changed the SortOrder.

I compiled and restarted NT6.5. Loaded a chart with MikesMinuteBarType and it looks perfect on historical data but live data doesn't build a bar. It displays every individual tick. I don't understand this as my code is copied directly from NT's with only those changes I mentioned.

Any ideas why this is happening.

Thanks for your help...

Mike

Started this thread Reply With Quote
  #13 (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


It would help if you can you post your cs file. Thanks.

Reply With Quote
  #14 (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

here you go.

Thanks for looking at this.

Mike

Attached Files
Elite Membership required to download: MikesMinuteBarsType.zip
Started this thread Reply With Quote
  #15 (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
Loaded a chart with MikesMinuteBarType and it looks perfect on historical data but live data doesn't build a bar. It displays every individual tick.

Any ideas why this is happening.

You are dealing with some kind of Ninja bug. For some reason, NT is calling Add() with a time == current bar time (which is in the future for min bars, as the timestamp is the end of the bar) for each tick.

I went thru the same exercise you did, and copied the Ninja code as is, and only changed the sortid and period type, and got the same behavior. I added some debug statements to see the incoming timestamps. As each tick is coming in, NT is incrementing the timestamp by 1 min, causing a new bar to be generated. If you really want minute based bars, you will have to talk with NT support.

As you move forward, most bar types are generated from ticks, not minute bars. You change that in the BuiltFrom() method.

P.S. You should also change the value of the DisplayName() routine to return a different string, as yours is returning "Custom8". This routine sets the value shown in the intervals menu items.

P.S.S. Here is a quick and dirty routine to add a Debug statement:
 
Code
private void Debug(string msg) 
{
	using (System.IO.StreamWriter sw = System.IO.File.AppendText("C:\\debug.txt")) 
	{
		sw.WriteLine(msg);
	}
}
The using block will close the file for you. You can then do something like the following to see the timestamp issues:
 
Code
if (isRealtime)
	Debug(bars.Count+" time="+time+" lbTime="+lastBar.Time);

Reply With Quote
Thanked by:
  #16 (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 for you effort and your much better way to debug than what I've been doing.

I wish you had seen something stupid that I'd done but guess not. I guess this will have to sit because nt won't support custom bartypes.

Thanks again,
Mike

Started this thread Reply With Quote
  #17 (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

Just for grins, the same exercise works fine in NT7.

Reply With Quote
Thanked by:
  #18 (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

That's funny. I'll work in NT7 on this little project. Just want to prove a concept anyway. I'll let you know how it turns out.

Started this thread Reply With Quote
  #19 (permalink)
 dalebru 
Indianapolis/IN
 
Experience: Intermediate
Platform: SC, NT, ToS, my own
Broker: EdgeClear
Trading: ES
Posts: 67 since Jan 2013
Thanks Given: 1,035
Thanks Received: 110

This is an old thread, but here is how I use Visual Studio to debug a custom BarsType (in addition to writing debyg output to a file):

1. Compile an indicator in NT, in Debug mode (this also compiles the BarsType).
2. Exit and restart NT (this loads the new BarsType into memory).
3. Compile an indicator in NT, in Debug mode (yes, again. Seems necessary for NT to "know" we're really debugging).
4. In Visual Studio, do Tools Attach to NinjaTrader.
5. In NT, apply your custom indicator. Now your VS breakpoints will be hit.

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