• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Region slow when scrolling mouse wheel

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

  • Harry
    replied
    Draw.Region bug for negative replacements

    When a negative displacement is used (pretty unusual), there are increased gaps in the fill area, see chart below.
    Attached Files

    Leave a comment:


  • Harry
    replied
    RC2 - Draw.Region bug not fixed

    With RC2 Draw.Region still does not work properly when the overload providing for a displacement is used.

    The area is not filled when the bar to which Draw.Region() is attached is within the first N bars on the visible section of the chart, where N is the displacement.

    For example the chart below has 9 bearish bars and the area is not filled with a displacement of 10 bars.
    Attached Files

    Leave a comment:


  • fx.practic
    replied
    Here is the answer:

    Code:
    Up_Zone.EndAnchor.DrawnOnBar   = 0; 
    Up_Zone.StartAnchor.DrawnOnBar = CurrentBar;

    Leave a comment:


  • fx.practic
    replied
    When You put Draw.Region in OnBarUpdate() method - You creating new Region object on each bar again and again.

    Regions work march more faster in NT7 in this implementation:
    Code:
    IRegion Up_Zone;
    
    void override OnStartUp()
    {
    Up_Zone = DrawRegion("Up_Zone", 0, 0, LineUp1, LineUp2, Color.Empty, Color.Blue, 10 );	
    }
    
    void override OnBarUpdate()
    {
    Up_Zone.EndBarsAgo = 0;	
    }
    Now I searching way to do same in NT8.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi Harry and kognam,

    This bug is being tracked with ID #NTEIGHT-9927.

    (I think we just needed to get the terminology right to make sure everyone is on the same page.)

    Leave a comment:


  • koganam
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hi Harry,

    I'm actually just now understanding what you were trying to point out.

    The region is not being displaced from the first actual bar (as in bar 0), it is being displaced from the left side of the rendered area, which would be a bug.

    When you mentioned in post #11 "For example if a displacement of 20 bars is selected, the region will not be plotted for the first 20 bars on the chart.", I understood this as the first 20 bars from bar 0 will not be plotted, which is the expected behavior.

    I've put in a bug report about this. Once I have a tracking ID for this bug report I will post this ID in this thread.

    Thank you for your clarification to get me pointed in the right direction.
    I am glad that you have finally decided that this is a bug after all, but, with all due respect, this was first pointed out more than 6 months ago.

    ref: http://ninjatrader.com/support/forum...ad.php?t=80674

    I have coded around it, and my implementation shows the cloud from the start of the chart. Still, it is a bug.

    Leave a comment:


  • Harry
    replied
    Chelsea,

    That is exactly the point.

    Thank you for your help.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi Harry,

    I'm actually just now understanding what you were trying to point out.

    The region is not being displaced from the first actual bar (as in bar 0), it is being displaced from the left side of the rendered area, which would be a bug.

    When you mentioned in post #11 "For example if a displacement of 20 bars is selected, the region will not be plotted for the first 20 bars on the chart.", I understood this as the first 20 bars from bar 0 will not be plotted, which is the expected behavior.

    I've put in a bug report about this. Once I have a tracking ID for this bug report I will post this ID in this thread.

    Thank you for your clarification to get me pointed in the right direction.
    Last edited by NinjaTrader_ChelseaB; 05-27-2016, 11:54 AM.

    Leave a comment:


  • Harry
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Harry,

    Are you using displacement on the Draw.Region call itself?
    (This would cause the first bars up to the displacement to not be plotted)

    Draw.Region(this, "region", CurrentBar, 0, Values[0], Values[1], Brushes.Transparent, Brushes.Blue, 9, 20);
    Draw.Region(NinjaScriptBase owner, string tag, int startBarsAgo, int endBarsAgo, ISeries<double> series1, ISeries<double> series2, Brush outlineBrush, Brush areaBrush, int areaOpacity, [int displacement])

    If so, this would be the expected behavior when using displacement on the Draw.Region() object. The bars up to the displacement number are not plotted and the slots after the last bar will be plotted up to the displacement number.


    Or are you setting the Displacement of the entire indicator and not using the displacement overload on the draw region?

    Draw.Region(this, "region", CurrentBar, 0, Values[0], Values[1], Brushes.Transparent, Brushes.Blue, 9);

    http://ninjatrader.com/support/helpG...splacement.htm

    With the entire indicator set with Displacement this should not cause the region to be displaced. This should only displace the plots.

    Thank you for your quick answer. Actually there are two different cases.

    (1) First case (BollingerBands): When I am displacing the Bollinger Bands, I also wish to displace DrawRegion along with it. This is obvious, as otherwise the region would not match the plots. For that purpose I use the displacement feature or DarwRegion. The result is not satisfactory, as part of the area between the plots remains empty.

    (2) Second case (Ichimoku): In this case it is not the entire indicator which is displaced, but the DrawRegion() is used to plot the cloud forward. But also in this case part of the cloud is missing and as you see from my screenshot, there is a big hole in the middle of the chart.

    I want to point out that the way the displacement feature has been implemented for DrawRegion(), it is entirely useless. It is NOT working as expected and cannot be used as needed for correctly implementing indicators.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Harry,

    Are you using displacement on the Draw.Region call itself?
    (This would cause the first bars up to the displacement to not be plotted)

    Draw.Region(this, "region", CurrentBar, 0, Values[0], Values[1], Brushes.Transparent, Brushes.Blue, 9, 20);
    Draw.Region(NinjaScriptBase owner, string tag, int startBarsAgo, int endBarsAgo, ISeries<double> series1, ISeries<double> series2, Brush outlineBrush, Brush areaBrush, int areaOpacity, [int displacement])

    If so, this would be the expected behavior when using displacement on the Draw.Region() object. The bars up to the displacement number are not plotted and the slots after the last bar will be plotted up to the displacement number.


    Or are you setting the Displacement of the entire indicator and not using the displacement overload on the draw region?

    Draw.Region(this, "region", CurrentBar, 0, Values[0], Values[1], Brushes.Transparent, Brushes.Blue, 9);

    http://ninjatrader.com/support/helpG...splacement.htm

    With the entire indicator set with Displacement this should not cause the region to be displaced. This should only displace the plots.

    Leave a comment:


  • Harry
    replied
    DrawRegion with Displacement Bug

    When DrawRegion() is used with a displacement, the region is not properly filled.

    For example if a displacement of 20 bars is selected, the region will not be plotted for the first 20 bars on the chart.

    Below are two samples that show the problem.

    First chart: Multiple Bollinger Bands with a displacement of 20 bars

    Second chart: An Ichimoku indicator which uses DrawRegion to plot the Kumo (cloud) forward. When there are less than 26 bars on the chart, the forward section of the cloud is incomplete. (The code only uses the displacement for the forward section of the cloud, but not for the main cloud, which is created from a displaced DataSeries.)
    Attached Files
    Last edited by Harry; 05-27-2016, 04:40 AM.

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    Thanks Harry - we'll be applying some optimizations to the @Reigion class in B6 - NTEIGHT-8867

    Leave a comment:


  • Harry
    replied
    Originally posted by NinjaTrader_Matthew View Post
    Thanks I'll have a look, I appreciate it.

    Regarding the crash, is that always reproducible? Was there an existing bug report on that in B5?
    In fact it was not a crash. It just had that turning symbol instead of the mouse arrow, but I was still able to click the button and it worked.

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    Originally posted by Harry View Post
    I have basically taken the Bollinger indicator, added two more channels and then used Draw.Region() to fill the segments between the channels.

    I have used one tag for the entire series. Otherwise it would take over a minute to load the indicator, and CPU load would be further increased.

    Code:
                if(Opacity3 > 0)
                {    
                    Draw.Region(this,"UB3", CurrentBar , 0, Upper3, Upper2, transparentBrush, OuterAreaBrush, Opacity3);
                    Draw.Region(this,"LB3", CurrentBar , 0, Lower2, Lower3, transparentBrush, OuterAreaBrush, Opacity3);
                }
                if(Opacity2 > 0)
                {    
                    Draw.Region(this,"UB2", CurrentBar , 0, Upper2, Upper1, transparentBrush, MidAreaBrush, Opacity2);
                    Draw.Region(this,"LB2", CurrentBar , 0, Lower1, Lower2, transparentBrush, MidAreaBrush, Opacity2);
                }
                if(Opacity1 > 0)
                {    
                    Draw.Region(this,"UB1", CurrentBar , 0, Upper1, Middle, transparentBrush, InnerAreaBrush, Opacity1);
                    Draw.Region(this,"LB1", CurrentBar , 0, Middle, Lower1, transparentBrush, InnerAreaBrush, Opacity1);
                }
    I cannot attach the indicator script, because NinjaTrader 8 hangs (crash) when I try to export an indicator file.
    Thanks I'll have a look, I appreciate it.

    Regarding the crash, is that always reproducible? Was there an existing bug report on that in B5?

    Leave a comment:


  • Harry
    replied
    Originally posted by NinjaTrader_Matthew View Post
    Thanks for the detailed report. There are definitely some performance improvements in this area we have scheduled as we do ongoing maintenance throughout beta. I'm going to check with development on your scenario to see where we are.

    Just so we're looking at apples to apples, can you provide the script you are testing with?

    Or can you clarify how you've implemented Draw.Region? When you say that you are drawing the areas between the bands, is this through one instance (e.g., using one tag) for the whole series? Or are you drawing on multiple bars and creating new instances?
    I have basically taken the Bollinger indicator, added two more channels and then used Draw.Region() to fill the segments between the channels.

    I have used one tag for the entire series. Otherwise it would take over a minute to load the indicator, and CPU load would be further increased.

    Code:
                if(Opacity3 > 0)
                {    
                    Draw.Region(this,"UB3", CurrentBar , 0, Upper3, Upper2, transparentBrush, OuterAreaBrush, Opacity3);
                    Draw.Region(this,"LB3", CurrentBar , 0, Lower2, Lower3, transparentBrush, OuterAreaBrush, Opacity3);
                }
                if(Opacity2 > 0)
                {    
                    Draw.Region(this,"UB2", CurrentBar , 0, Upper2, Upper1, transparentBrush, MidAreaBrush, Opacity2);
                    Draw.Region(this,"LB2", CurrentBar , 0, Lower1, Lower2, transparentBrush, MidAreaBrush, Opacity2);
                }
                if(Opacity1 > 0)
                {    
                    Draw.Region(this,"UB1", CurrentBar , 0, Upper1, Middle, transparentBrush, InnerAreaBrush, Opacity1);
                    Draw.Region(this,"LB1", CurrentBar , 0, Middle, Lower1, transparentBrush, InnerAreaBrush, Opacity1);
                }
    Indicator is attached.
    Attached Files
    Last edited by Harry; 09-25-2015, 01:51 PM.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Gav_G, Today, 10:35 AM
0 responses
2 views
0 likes
Last Post Gav_G
by Gav_G
 
Started by traderpards, Today, 09:55 AM
1 response
8 views
0 likes
Last Post NinjaTrader_Melissa  
Started by MojoJojo, Today, 09:53 AM
0 responses
5 views
0 likes
Last Post MojoJojo  
Started by lunardiplomacy, Today, 08:23 AM
5 responses
17 views
0 likes
Last Post lunardiplomacy  
Started by Gerik, Today, 06:36 AM
1 response
7 views
0 likes
Last Post NinjaTrader_Kate  
Working...
X