Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Working...
        X