Profile Picture

Accessing trading system class

Posted By krschacht 5 Years Ago
Message
Posted Tuesday January 03 2012
Within the SymbolScript class I can access the trading system by referencing TradingSystem.(various method). However, when I write my own class I can't access TradingSystem methods.

How do I reference it? I tried putting it inside the namespace, outside the namespace. I can't figure out where the main instance of TradingSystem is instantiated.

Thanks,
Keith
Posted Tuesday January 03 2012
You either need to pass the reference to the class that needs it, or you can create a static property that holds a reference to your trading system. Something like this:

// In trading system class
public static MySystem Instance { get; private set; }

// In trading system class constructor
Instance = this;

// To access from elsewhere
MySystem.Instance.Method()

Thanks,
Daniel
Posted Tuesday January 03 2012
Thanks!


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems