Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling GetAtmStrategyUniqueId in indicator

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

    Error on calling GetAtmStrategyUniqueId in indicator

    Hi,
    While I have succeeded in coding a "click to order" strategy to initiate ATM strategy orders, I'm not satisfied with it because it cannot be pegged to a template (e.g. loaded by default) and there are some confusion over the account (what the strategy says vs what the ChartTrader says). To be honest, using Strategy as a base offers very little for ATM strategy manipulation e.g. no OnOrderUpdate etc. so I decided to recode what I did as an indicator.

    I managed to get everything compiled but when I run it, I get:
    Error on triggering custom event for NinjaScript 'QuickEntry' on bar 2734: 'GetAtmStrategyUniqueId' method can only be called in state 'Realtime'

    Now, I'm 100% sure the State is Realtime when that method is called. So, does that mean I can't use methods like GetAtmStrategyUniqueId/AtmStrategyCreate etc. in an indicator? If I want to do that, what should I try then?

    Thanks in advance for your advice.

    #2
    Hello mav8rick,

    Thanks for the post.

    Just to clarify what you explained with the strategy is generally correct, most often if you want to have greater control over manual orders/ATM or have use of the chart trader account an indicator is best for that use case. Strategies are really intended to be programmed with a task and specific settings like an account and then left to work that task.

    From the error you are getting I couldn't really provide an answer at what may be happening. The methods being used are specifically for the Strategy ATM system so that may be part of the problem. If you are using an Indicator you could use the Addon ATM system. There is a sample addon that uses ATM's, that is more complex of a sample but has all of the correct syntax. The only item which would need to be exchanged would be how the ATM is selected/created as the addon has a GUI which your indicator will not. If you are using the chart trader ATM selector then the code would actually be very similar. https://ninjatrader.com/support/help...t_overview.htm

    In the sample the OCO is created using the following syntax:
    Code:
    string oco = Guid.NewGuid().ToString("N");
    I look forward to being of further assistance.

    Comment


      #3
      Thank you Jesse,
      I "retreated" back to using a strategy because I didn't want to use an addon (I loaded it but somehow maybe what I coded earlier affected certain things so I started to get "invalid object reference" when I start up NT - no, not asking for help on that - removed the addon and my experimental code and everything is OK).
      The strategy has most of what I need but it just irks me that I can't pack it into a template to be loaded together with my indicators that's all.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      595 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      554 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X