Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using ATI functions within NinjaScript

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

    Using ATI functions within NinjaScript

    Hello,
    I want to implement money management rules into automated trading over several strategies.Therefore I have started the creation of a centralized "RiskManager" class in the "UserDefinedMethods.cs" file.

    Currently I am working on implementing the basic functionality provided by the class. I'd like to have a function "isConnected()" giving me back the state of my broker connection (e.g. as boolean value). Furthermore I want to access strategy relevant information.

    By searching the forums and help I found the "ATI DLL Interface Functions" most suitable for providing the desired functionality. Especially following functions are of interest to me:
    PHP Code:
    int Command(stringcommand, stringaccount, stringinstrument, stringaction, intquantity, stringorderType, doublelimitPrice, doublestopPrice, stringtimeInForce, stringoco, stringorderId, stringstrategy, stringstrategyId)
     
    int Connected(intshowMessage) 
    string Strategies(stringaccount) 
    int StrategyPosition(stringstrategyId) 
    
    How can I use these functions within the "normal" NinjaScript? If I can't, how would I substitute the above mentioned functions?

    #2
    Hello PadanKane,

    Thank you for your post.

    The function int Command() submits, cancels, or changes orders. These functions are readily available through the Strategy namespace in NinjaScript, but cannot be accessed through the UserDefinedMethods.cs file for the strategies. Please visit the following link for the functions and methods available for strategies in NinjaScript: http://www.ninjatrader.com/support/h...7/strategy.htm

    int Connected would be OnConnectionStatus in the strategies and indicators: http://www.ninjatrader.com/support/h...tionstatus.htm

    string Strategies() would pull the ATM Strategies of the account referenced, in NinjaScript this is not available. You would need to reference the ATM Strategies Id, but the ATM Strategy would need to be sent from the NinjaScript strategy. You can find information on this item at the following link: http://www.ninjatrader.com/support/h...tionstatus.htm
    An example of using ATM Strategies in your code can be found by going to Tools --> Edit NinjaScript --> Strategy --> SampleAtmStrategy.

    int StrategyPosition() would be the same as GetAtmStrategyMarketPosition() in NinjaScript: http://www.ninjatrader.com/support/h...etposition.htm

    The UserDefinedMethods are used to create your own methods to be used across strategies or indicators, but the functions and methods of the strategies and indicators are not available in the UserDefinedMethods nor are the DLL Functions. Information on the UserDefinedMethods can be found at the following link: http://www.ninjatrader.com/support/h...ed_methods.htm

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    628 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    359 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    562 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X