Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NTB9 can draw objects to the right of last bar.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    NTB9 can draw objects to the right of last bar.

    In NTB8 i was able to draw an obect to the right of the last bar by simply putting an negative number in the "bars ago" as you can see below, I have put a -10. This used to cause the object to draw 10 bars into the future. Now it draws on the last bar and never any further to the right no matter what the negative number may be.

    Any thoughts?


    Draw.Square(this,"SquareExample",false,-10,price,Brushes.Red);
    Last edited by marty087; 02-19-2016, 06:07 AM.

    #2
    Originally posted by marty087 View Post
    In NTB8 i was able to draw an obect to the right of the last bar by simply putting an negative number in the "bars ago" as you can see below, I have put a -10. This used to cause the object to draw 10 bars into the future. Now it draws on the last bar and never any further to the right no matter what the negative number may be.

    Any thoughts?


    Draw.Square(this,"SquareExample",false,-10,price,Brushes.Red);
    There are complications in using negative bar values for draw methods that we are actively researching as of this beta release. This issue can be tracked using ID# NTEIGHT-9404
    MatthewNinjaTrader Product Management

    Comment


      #3
      I noticed the same problem in all my chart where I use -5 to draw lines in the future. But what I not understand is why it was correct in NT8 version 8.0.0.8 and after update to 8.0.0.9 this problem comes up?

      Why comes new problems up after updates when it work correct in a lower update version?

      Christian

      Comment


        #4
        For anyone interested. Here is my solution


        Code:
        		protected override void OnBarUpdate()
        		{
        			myLine = Draw.VerticalLine(this,"TheLine", FutureBarsToTime(20),Brushes.Black);//.IsLocked = false;		
        			
        		}
        		
        		DateTime FutureBarsToTime(int BarsIntoFuture)
        		{
        			DateTime BarTime0 = Time[0]; //time of this bar
        			DateTime BarTime1 = Time[1]; //time of bar 1 back
        			DateTime BarTime2 = Time[2]; //time of bar 2 back
        			
        			System.TimeSpan TimePerBar = BarTime0.Subtract(BarTime1);//span between current bar and 1 back
        			System.TimeSpan TimePerBar2 = BarTime1.Subtract(BarTime2); //span between 1 bar back and 2 bars back
        			
        			if (TimePerBar2.Ticks < TimePerBar.Ticks) TimePerBar = TimePerBar2; //checking the differnece between 2 x bar spans to ensure we are not modelling a gap and taking the lesser time span if different
        			
        			System.TimeSpan TimeIntoFuture = TimeSpan.FromTicks(TimePerBar.Ticks * BarsIntoFuture); // create the time span into the future
        			
        			DateTime TimeNow = Time[0];
        			DateTime TimeToDraw = TimeNow.Add(TimeIntoFuture); // add the time span to the current bar
        			
        			return(TimeToDraw);
        		}
        Attached Files
        Last edited by marty087; 02-23-2016, 04:45 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        602 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        22 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        20 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Started by agclub, 04-21-2024, 08:57 PM
        3 responses
        17 views
        0 likes
        Last Post TradingLoss  
        Working...
        X