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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X