Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing method optimization

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

    Drawing method optimization

    Hello! I'm working on a Ichimoku indicator and I used Draw.Region() function in order to draw the kumo (the cloud) 26 periods in the future as we don't have the ability to displace a specific dataSerie/Line in a multi line indicator like Ichimoku.
    Here is a part of my code :

    ```
    protected override void OnBarUpdate()
    {
    ...
    Values[2][0] = senkouSpanA; // Senkou Span A
    Values[3][0] = senkouSpanB; // Senkou Span B​
    // Use DrawRegion to fill the area between Senkou Span A and Senkou Span B
    string regionID = "KumoCloud" + CurrentBar;
    Brush outlineColor = new SolidColorBrush(Color.FromArgb(70, 78, 45, 13));
    Brush areaColor = new SolidColorBrush(Color.FromArgb(30, 54, 137, 164));
    Draw.Region(this, regionID, CurrentBar, 0, Values[2], Values[3], outlineColor, areaColor, 100, 26);
    }
    ```
    The thing is this method draw a slice of the cloud for every bar and there is a lot of drawing objects on the chart. If I extend the chart too much this become laggy.
    Do you know if there is a better way to draw the ichimoku cloud on the chart ?

    #2
    Hello Tessan,

    You may find the ichimoku indicators on the User App Share have helpful code for adjusting the region displacement.


    This thread will remain open for any community members that would like to provide advice as to what logic you should write.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    127 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    73 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    115 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    109 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    88 views
    0 likes
    Last Post CarlTrading  
    Working...
    X