Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can fast approach of Draw.Region() be used when indicator in hosted in strategy?

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

    Can fast approach of Draw.Region() be used when indicator in hosted in strategy?

    Hello.

    To speedup Draw.Region() I using approach like this:
    PHP Code:
    public class iHostedDrawRegion : Indicator
    {
        Region My_Region;
        
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Name = "iHostedDrawRegion";
            }
            else if( State == State.DataLoaded )
            {
                My_Region = Draw.Region(this, "Region", 0, 0, Low, High,   null, WmBrushes.LimeGreen, 70 );    
            }
        }
    
        protected override void OnBarUpdate()
        {
            My_Region.EndAnchor.DrawnOnBar = CurrentBar;
        } 
    
    It works very fast and stable in indicator.

    But, if to add indicator in strategy - it not draw.


    Is there any way to let it work?
    Attached Files
    Last edited by fx.practic; 08-07-2017, 02:45 PM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    I found out, that My_Region.OnRender() not triggered from host strategy.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello fx.practic,

      Thank you for your post.

      I am testing the strategy and indicator here. I will look into this further and follow up when I have more details. If you have any questions in the meantime please let me know.

      Comment


        #4
        Thank You, Patrick, very march!

        It is great tool, and I just can't work without it.
        Recreation of region on each bar is very-very slow.

        I made naive try to call Region.OnRender() from Strategy.OnRender(), but got exception RenderTarget == null
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #5
          Hello, Patrick
          Just want to say I still need it very much.
          Hope You can find way.
          I made some crazy experiments - but no one give good results.
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            Hello fx.practic,

            Thank you for your patience.

            Drawing in the OnStateChange function is not supported. Seeing this work in the indicator itself is not expected, but there is no expected behavior.

            Even if you would expect this to be more efficient it is unfortunately not supported.

            Please let me know if you have any questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            89 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            135 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            69 views
            0 likes
            Last Post PaulMohn  
            Working...
            X