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 Tamza, Today, 08:56 AM
          0 responses
          1 view
          0 likes
          Last Post Tamza
          by Tamza
           
          Started by Abdullah_KSA, Today, 08:47 AM
          0 responses
          2 views
          0 likes
          Last Post Abdullah_KSA  
          Started by xxzbill, Yesterday, 06:59 PM
          1 response
          18 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by vantojo, Today, 08:21 AM
          3 responses
          7 views
          0 likes
          Last Post NinjaTrader_Tyler  
          Started by sidlercom80, Today, 03:45 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X