Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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(stringcommandstringaccountstringinstrumentstringactionintquantitystringorderTypedoublelimitPricedoublestopPricestringtimeInForcestringocostringorderIdstringstrategystringstrategyId)
     
    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 Max238, Today, 01:28 AM
    1 response
    22 views
    0 likes
    Last Post CactusMan  
    Started by giulyko00, Yesterday, 12:03 PM
    2 responses
    10 views
    0 likes
    Last Post giulyko00  
    Started by r68cervera, Today, 05:29 AM
    0 responses
    4 views
    0 likes
    Last Post r68cervera  
    Started by geddyisodin, Today, 05:20 AM
    0 responses
    6 views
    0 likes
    Last Post geddyisodin  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    6 responses
    38 views
    0 likes
    Last Post JonesJoker  
    Working...
    X