Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Render from Strategy Opacity and ZOrder painting problem

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

    Render from Strategy Opacity and ZOrder painting problem

    ​The SharpDX.Direct2D1.Brush type has an Opacity property. Valid values 0 - 1. A value of .5 is 50% transparent. Using this brush in a call to RenderTarget.FillRectangle within an NT indicator produces a rectangle that's shaded as per the Opacity property.
    The same script converted to an strategy has a problem.

    The Opacity property has no effect on the rendering.
    The opacity of the filled rectangle seems to be fixed at a preset value.
    The bar data is on top of the drop shadow AND it's on top of the text items.

    Attached are an indicator (awxEconomicNews) and strategy (awxEconomicNewsStrat). They are identical except for how the color properties are coded but that's irrelevant as I have another script (not shared) that is a strategy that also can not make use of the Opacity property.
    See here for screen shot example. The chart on the left is running the strategy, the right the indicator. You can see that in the indicator version the news items have a drop shadow that partially occludes the bars. But not the strategy version on the left.

    Click image for larger version  Name:	awxNews.PNG Views:	0 Size:	93.4 KB ID:	1163925

    And here's another view with blue background:
    Click image for larger version  Name:	awxNews2.PNG Views:	0 Size:	95.9 KB ID:	1163927


    It seems that there are at least 2 problems with the strategy version: Opacity is not changing and the bar data is on top of the rendering.

    I have some strategies that need to paint their info. Their hosted indicators do not have all the data to paint because some of the info is strategy oriented like position info.
    I wrote a strategy that HOSTS the awxEconomicNews indicator. This is also attached in the zip file. The strategy is called HostNewsIndy. This strategy is able to set the data that the awxEconomicNews is painting and the strategy hosted awxEconomicNews indicator is painting correctly.

    Click image for larger version  Name:	awxNewsIndyHostedByStrat.PNG Views:	0 Size:	73.4 KB ID:	1163926
    So while there is a work around for this problem for the use cases that I foresee, there's something going on with the rendering from the Strategy side that might be a problem for someone (or me in the future).
    Last edited by Brillo; 07-19-2021, 08:01 AM.

    #2
    Hi Brillo, thanks for posting.

    The Z-Order for strategies can be set in State.Historical:

    if(State == State.Historical)
    {
    SetZOrder(int.MaxValue); //will ensure the strategy plots/renders above all other objects on the chart.
    }

    Please let me know if this does not resolve your inquiry.

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi Brillo, thanks for posting.

      The Z-Order for strategies can be set in State.Historical:

      if(State == State.Historical)
      {
      SetZOrder(int.MaxValue); //will ensure the strategy plots/renders above all other objects on the chart.
      }

      Please let me know if this does not resolve your inquiry.
      Yes it absolutely did !
      It's great that we can control the ZOrder but why isn't it the default that a strategy's rendering be on top?

      Comment


        #4
        Hi Brillo, thanks for your reply.

        I will need to ask if this is expected or not. I will let you know ASAP.

        Best regards.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X