Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Managed vs Unmanaged

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

    Managed vs Unmanaged

    I am using an unmanaged Strategy to handle special situation while other Strategies are managed. So I have both managed and unmanaged Strategies defined, of course I won't use them at the same time. For this special unmanaged strategy, I have to declare this:

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    IsUnmanaged = true;
    }
    }


    The problem is, OnStateChange() can be called for all Strategies either managed or unmanged, in other words, IsUnmanaged can be set to either "true" or "false". How do I resolve it? Thanks.

    #2
    Hello localappleseed,

    The OnStateChange override is defined in every strategy so each one will have its own individual SetDefaults state. In this example, this specific strategy would be unmanaged. All other strategies which don't have IsUnmanaged = true; defined in their code won't be managed by default.

    When you set variables like this it will have no effect on other strategies, this is being set only for that one strategy.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I got the following errors even I declared IsUnamanged = true. I am not sure why it is still in managed?
      Error on calling 'OnBarUpdate' method on bar 0: Strategy 'LLL2/212851947': 'SubmitOrderUnmanaged' method can't be called on managed strategies.

      protected override void OnBarUpdate()
      {
      ...
      myExit = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Limit, 100, GetCurrentAsk()+0.1, 0, "", "Buying 100");
      ...
      }

      Comment


        #4
        Hello localappleseed,

        If you just made that change but didn't remove/re apply the strategy you would see that error. Any changes to your strategies SetDefaults or its Class structure like user inputs would require re applying it.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Yes, per your guideline, it worked! But it looks like I have to remove, shutdown and re-start Strategy to make it work. Removing and reapply Strategy was not enough.
          Thanks a lot.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Anthony_0709, Today, 01:29 PM
          2 responses
          6 views
          0 likes
          Last Post Anthony_0709  
          Started by kenbun, Today, 12:21 PM
          0 responses
          9 views
          0 likes
          Last Post kenbun
          by kenbun
           
          Started by WNorton, Today, 11:23 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Spencer  
          Started by stafe, Today, 10:43 AM
          0 responses
          12 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by UltraNIX, Today, 09:13 AM
          3 responses
          18 views
          0 likes
          Last Post UltraNIX  
          Working...
          X