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

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"00LowHigh,   nullWmBrushes.LimeGreen70 );    
            }
        }

        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 rtwave, 04-12-2024, 09:30 AM
            2 responses
            20 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Started by tsantospinto, 04-12-2024, 07:04 PM
            5 responses
            67 views
            0 likes
            Last Post tsantospinto  
            Started by cre8able, Today, 03:20 PM
            0 responses
            6 views
            0 likes
            Last Post cre8able  
            Started by Fran888, 02-16-2024, 10:48 AM
            3 responses
            49 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Started by martin70, 03-24-2023, 04:58 AM
            15 responses
            115 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X