Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create new user defined methods in NT8?

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

    How to create new user defined methods in NT8?

    Hello!

    How can I create new methods in NT8, in order to be accessible from my own strategies?

    In NT7, the proccess was begining from the "UserDefinedMethods" template but, now in NT8, I am not able to find something similar and I dont know how to create them.

    Thank you in advance.
    Regards.

    #2
    Hello ccruells,

    Add the code the Indicator or Strategy namespace in a .cs file placed in the Addons folder.

    Below is a link to a script that demonstrates.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello NT Chelsea,
      Please see the attached screenshot and scripts for demonstrating my question. I'm trying to understand the sample addons you provided but with a previously created NT7 "UserDefinedMethods" template file I had used successfully. For some reason,(on a different complex code) the bar coloring was shifted by 8 or 10 minutes. Please let me know if you see any offending or possible reason for this anomaly.
      Thanks.
      Kirk
      Attached Files
      Last edited by zeller4; 08-01-2023, 02:32 PM. Reason: Adding other SharedMethods v00 file with more "IsReportTime" code

      Comment


        #4
        Hello zeller4,

        The UserDefinedMethods file in NinjaTrader 7 was just a partial class.

        You can do the same in NinjaTrader 8 in new .cs file (with any name). You can call it UserDefinedMethods if you want.

        As far as the bar coloring being shifted, BarBrush is the property to set to set the current bars color. Are you assigning BarBrushes[barsAgo index] of a previous bar?

        Is the condition evaluating as true when you expect?

        Below is a link to a forum post on using prints to understand behavior.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        54 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        72 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X