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

UserDefinedMethods.cs

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

    UserDefinedMethods.cs

    Hello,

    I've seen the sample UserDefinedMethods.cs strategy file. This has two samples - 1 for IsMorningSession and HigherPrices (both bool).

    Are there other samples for the indicators file?

    Are the results available as int or double or DataSeries as well?

    Would there be a reason to NOT use DataSeries (if historical info is needed)?

    In the Overview section, it states
    You can not share user defined methods created for custom strategies with custom indicators.
    Does that mean that only the unique names (of the .cs file and individual method) is required or does it have to also do with how or from where it is called?

    Thanks for any samples you can give.

    Kirk

    #2
    Hello Kirk,

    Unfortunately there aren't additional samples available. The samples were written to return true or false but you could write methods that return int or double as well. If you're looking for more information on what you could do here, look into general C# reference on writing methods.

    Creating and managing custom methods for data series shouldn't be done here, because they need to be instantiated in Initialize() method and values set in OnBarUpdate(). This framework requires creating a custom indicator.

    Indicator methods are available to indicators and strategies. Strategy methods are available only to strategies. The unique name must be provided to call the method. You don't have to reference a file. The custom methods are added and accessible just by the method name.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kevinenergy, 02-17-2023, 12:42 PM
    117 responses
    2,766 views
    1 like
    Last Post jculp
    by jculp
     
    Started by Mongo, Today, 11:05 AM
    5 responses
    15 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by SightCareAubetter, Today, 12:55 PM
    0 responses
    3 views
    0 likes
    Last Post SightCareAubetter  
    Started by traderqz, Today, 12:06 AM
    8 responses
    16 views
    0 likes
    Last Post traderqz  
    Started by SightCareAubetter, Today, 12:50 PM
    0 responses
    2 views
    0 likes
    Last Post SightCareAubetter  
    Working...
    X