Understanding MTF bars, bar closure times, etc. - NinjaTrader Programming | futures io social day trading
futures io futures trading


Understanding MTF bars, bar closure times, etc.
Updated: Views / Replies:874 / 18
Created: by Jayswiss Attachments:4

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 4  
 
Thread Tools Search this Thread
 

Understanding MTF bars, bar closure times, etc.

  #1 (permalink)
Elite Member
San Francisco, CA / USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradingView
Favorite Futures: ES, TF, NQ, CL, GC
 
Posts: 29 since Jun 2016
Thanks: 4 given, 3 received

Understanding MTF bars, bar closure times, etc.

I'm trying to consistently mark an indicator panel with a bar-sized block every time the 30 minute bar closes.

(panel properties: fixed, points, 10,110, -10, linear)

My code looks something like:
 
Code
  protected override void Initialize()
        {
            Overlay = false;
            textFont = new Font("Arial",8);
            Add(PeriodType.Minute, 30);
        }

  protected override void OnBarUpdate()
        {
	      if (CurrentBar < 30)
       		return;

             DrawOnPricePanel = false;

              if (BarsInProgress == 1){
               //drawtext is for debug                
              DrawText(CurrentBar + 3.ToString() + CurrentBar, true, CurrentBar.ToString(), 0, 55, 1, Color.Red, textFont,    StringAlignment.Center, Color.Empty, Color.Empty, 0);
              
		DrawRectangle("tag"+CurrentBar, false, 0, 40, 1, 50, Color.Blue, Color.Blue, 2);
	        }

        //console dump for debug...
        
             if (BarsInProgress == 1){
			Print(Time[1] + "INDEX: " + BarsInProgress + "     BAR# " + CurrentBar);
			}

        }
So the problem is I wind up with seemingly stray rectangles drawn in the wrong place on timeline.
After adding console dump with timestamp + the DrawText to list the CurrentBar # above the squares, it seems like the bar # and times are correct though. Very confusing and unexpected output.

Image 1 (console output):
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

---
Image 2 (indicator view):
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Any ideas or advice here? Thanks


Last edited by Jayswiss; July 5th, 2016 at 10:15 PM.
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,474 since Sep 2013
Thanks: 1,696 given, 3,667 received
Forum Reputation: Legendary


What is your base data series ?
Do you need the base serie ?

Reply With Quote
 
  #4 (permalink)
Elite Member
San Francisco, CA / USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradingView
Favorite Futures: ES, TF, NQ, CL, GC
 
Posts: 29 since Jun 2016
Thanks: 4 given, 3 received


rleplae View Post
What is your base data series ?
Do you need the base serie ?

Base is 1min. Yes, need base.

I will have 1, 3, 5, 15 on same indicator, but I am just trying to understand why it is doing this with a simple 2 time frame for now.

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,474 since Sep 2013
Thanks: 1,696 given, 3,667 received
Forum Reputation: Legendary

what is the instrument ? what is the liquidity ?

if the instrument is very liquid, I think the 30 min will show 50% in between the 1 hour
if there are no ticks, it might be off and explain what you are seeing...

does that answer your question ?

Reply With Quote
 
  #6 (permalink)
Elite Member
San Francisco, CA / USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradingView
Favorite Futures: ES, TF, NQ, CL, GC
 
Posts: 29 since Jun 2016
Thanks: 4 given, 3 received


rleplae View Post
what is the instrument ? what is the liquidity ?

if the instrument is very liquid, I think the 30 min will show 50% in between the 1 hour
if there are no ticks, it might be off and explain what you are seeing...

does that answer your question ?


ES in this case.... that was in the middle of the night, but still it was moving within 30 minute TF

I was thinking it could be a "no ticks" situation. No ticks would mean onbarupdate wouldn't fire then, is that what you mean?

I don't think that's the case here though (but not 100% sure yet).

Is there something better or different available within Ninjatrader to accomplish basically marking the panel consistently with the bars from other timeframes? Instead of onbarupdate, maybe something that fires every X seconds or every minute?

This is a roundabout example of what I am trying to accomplish within Ninjatrader:
http://www.luckscout.com/have-all-timeframes-on-one-single-chart-in-your-metatrader-platform-mt4/

From there I do quite a bit more with it, but that indicator view is the starting point.

Reply With Quote
 
  #7 (permalink)
Elite Member
Los Angeles, California Republic
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES, Mongolian Horse Futures
 
srgtroy's Avatar
 
Posts: 1,456 since Jan 2011
Thanks: 1,009 given, 2,238 received

 
Code
Using declarations

namespace NinjaTrader.Indicator
{
    
   
    public class test : Indicator
    {
        protected override void Initialize()
        {
            Overlay		= false;
	    DrawOnPricePanel	= false;
			
	    Add(PeriodType.Minute, 30);
	    BarsRequired = 1;
        }

        
        protected override void OnBarUpdate()
        {
            if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired) return;
			
	    if (BarsInProgress == 1)
	    {
		DrawSquare("a1" + CurrentBars[0], false, 0, 1, Color.Blue);
	    }
          
        }
    }
}
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Last edited by srgtroy; July 7th, 2016 at 12:06 AM.
Reply With Quote
 
  #8 (permalink)
Elite Member
San Francisco, CA / USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradingView
Favorite Futures: ES, TF, NQ, CL, GC
 
Posts: 29 since Jun 2016
Thanks: 4 given, 3 received


srgtroy View Post
 
Code
Using declarations

namespace NinjaTrader.Indicator
{
    
   
    public class test : Indicator
    {
        protected override void Initialize()
        {
            Overlay		= false;
	    DrawOnPricePanel	= false;
			
	    Add(PeriodType.Minute, 30);
	    BarsRequired = 1;
        }

        
        protected override void OnBarUpdate()
        {
            if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired) return;
			
	    if (BarsInProgress == 1)
	    {
		DrawSquare("a1" + CurrentBars[0], false, 0, 1, Color.Blue);
	    }
          
        }
    }
}
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



How does this look at 15:30-16:00 EST? This is where I am currently seeing a dupe/stray...

Reply With Quote
 
  #9 (permalink)
Elite Member
Los Angeles, California Republic
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES, Mongolian Horse Futures
 
srgtroy's Avatar
 
Posts: 1,456 since Jan 2011
Thanks: 1,009 given, 2,238 received


Jayswiss View Post
How does this look at 15:30-16:00 EST? This is where I am currently seeing a dupe/stray...

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


This is Pacific Standard Time so 12:30 - 13:00. No strays. Note, however, there is no data between 13:15 and 13:30 so the next square looks closer but its actually correct.

Reply With Quote
 
  #10 (permalink)
Elite Member
San Francisco, CA / USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, TradingView
Favorite Futures: ES, TF, NQ, CL, GC
 
Posts: 29 since Jun 2016
Thanks: 4 given, 3 received



srgtroy View Post
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


This is Pacific Standard Time so 12:30 - 13:00. No strays. Note, however, there is no data between 13:15 and 13:30 so the next square looks closer but its actually correct.


Ah I see. I am actually running a drawing rectangles with start 0 end 30 in(to draw a 30 minute long rectangle). But in the case mentioned above, it winds up overlapping in some of those spots where the is no data.. Using your code and start 0 end 1 bars, it seems to draw them correctly now. I just need to figure out how to draw until the next bar instead of fixed 30 mins.

Reply With Quote

Reply



futures io > > > > > Understanding MTF bars, bar closure times, etc.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
BBANDS DOTS MTF FOR RANGE BARS fdtrader NinjaTrader Programming 22 May 27th, 2014 06:07 PM
Learning about secondary bar series and using MTF in Ninjatrader podski NinjaTrader 2 May 13th, 2013 12:04 AM
MTF Different Instruments Same time but handling missing bars leinster NinjaTrader 0 March 19th, 2013 09:03 AM
understanding Volume Tick Range bars Angelo1 Platforms and Indicators 2 November 29th, 2012 07:46 AM
Bar Type with User controlled start times DavidHP NinjaTrader 0 May 30th, 2011 11:42 AM


All times are GMT -4. The time now is 07:17 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-11 in 0.14 seconds with 20 queries on phoenix via your IP 54.92.194.75