Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

INFO: List of Strategies

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

    INFO: List of Strategies

    How do I get a list of the Strategies configured in NT8?

    I just want to get the Strategies much like the Control Center Strategies tab. I guess I am hoping for the "StrategyBase" so I can potentially control/view their status.

    #2
    When a strategy is enabled, it is added to the Account.Strategies collection and you can obtain information related to the strategy which is running.

    But if you're looking for all strategies which reside on the grid (meaning they are configured, but not enabled), there is no sort of public collection which holds this information.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Actually - sorry, there is a static Strategies collection in StrategyBase which will get you want you're looking for

      Code:
      foreach (StrategyBase strat in Strategies)
      {
      	Print(strat.Name + ": " + strat.State);	
      }
      MatthewNinjaTrader Product Management

      Comment


        #4
        Thanks Matt,

        I started to play with this, but it doesn't look like all the strategy methods are exposed at the StrategyBase level such as "IsEnabled", etc. I don't seem to be able to dynamically case this or even at compile time to a strategy eg. "((Strategies).strat).IsEnabled" as I get this error:

        Indicator 'SampleChartObjectsCollectionChanged': Error on calling 'OnStateChange' method: Unable to cast object of type 'NinjaTrader.NinjaScript.Strategies.GHPStrategy01' to type 'NinjaTrader.NinjaScript.Strategies.Strategy'.
        Originally posted by NinjaTrader_Matthew View Post
        Actually - sorry, there is a static Strategies collection in StrategyBase which will get you want you're looking for

        Code:
        foreach (StrategyBase strat in Strategies)
        {
            Print(strat.Name + ": " + strat.State);    
        }

        Comment


          #5
          IsEnable is part of the StrategyRender base, meaning it is a UI function. Dynamically enabling a strategy is not something we can currently support.
          MatthewNinjaTrader Product Management

          Comment


            #6
            Matt,

            Not trying to remotely enable the strategy, just trying to tell in this case if the strategy is enabled and running. There appear to be other Strategy based Properties/Fields that need to be obtained at that level.

            Comment


              #7
              I see - my mistake.

              The IsEnable property will just let you know if the strategy is enabled on a chart, and the other properties in the StrategyRenderBase are just used for charting.

              If you just want to monitor the strategy, in that case, you want to check the State of the strategy. If a State of a Strategy is Historical/Realtime, then it would indicate that it is running. You can also check other properties like "IsWaitUntilFlat", etc.

              If there other properties and fields that you cannot locate, or have a situation you're having trouble monitoring, let me know and I'll be happy to look into that further.
              MatthewNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Barry Milan, Yesterday, 10:35 PM
              5 responses
              16 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by DanielSanMartin, Yesterday, 02:37 PM
              2 responses
              13 views
              0 likes
              Last Post DanielSanMartin  
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              13 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              12 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              8 views
              0 likes
              Last Post nandhumca  
              Working...
              X