Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reference to external methods

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

    Reference to external methods

    Hi all,
    my idea was to create separated kontrola.cs file, where will be created any methods, those methods can be used by all other strategies. I want to store this file in "strategies" folder. I did this file and compile it successfull. I did second file with main strategy, that is also saved in folder "strategies". This concept works under NT7 ad I try to migrate it under NT8. By compiling this file, I receive two groups of exceptions and errors. 1) The name entryOrder does not exist in the current context. Vaiable entryOrder is defined in file kontrola.cs as public variable and I expected to see and use it in other strategy. 2) an object reference is required for the non-static field, method, or property...". I searched many sources but did not find relevant topics about this issue. Is this logic Ok, with one file of methods and many other strategies that refer to this file in strategies folder?​ If yes, how to solve this problem with reference?
    Best regards tom

    240314_NT8_TB_kontrola.cs
    240314_NT8_Propojeni_s_dalsim_souborem.cs

    #2
    Hello tomasak,

    For this I would recommend using a partial class.

    Below is a link to an example.
    Explanation: I wrote a base class Indicator class that I'm using to inherit all my other indicators from. So this baseclass is defined as: namespace NinjaTrader.NinjaScript.Indicators.AssistedTrades { public class ATBaseIndicator: Indicator { ... } } And any other indicator is defined as: namespace NinjaTrader.NinjaScr
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    67 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    143 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    76 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    47 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    51 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X