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

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 AaronKoRn, Today, 09:49 PM
    0 responses
    7 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    9 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    10 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,980 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X