Thank you for the post.
In this case, I wouldn't necessarily suggest inheriting from another strategy directly if you are trying to share a method, properties or data.
I would likely suggest using a class from the addon folder with some static properties. I have included an example of a class and properties below along with information on how to call that from your strategies. When exporting a shared item like this, you would need to have 3 exports. 1 for the class in the addons folder, and 1 for each strategy. After exporting the class, you could import the dll for it, and then start using the class in your strategies. When exporting the strategies, you would select the reference to the class along with your strategy in the export screen.
First, create a new addon and remove the existing code leaving the using statements at the top. Paste the following:
namespace NinjaTrader.NinjaScript.AddOns { public class ShareDataClass { public static int SomeIntValue = 33; public static int IntPropety {get;set;} public static double AReturnMethod() { return 1024.25; } } }
After exporting this addon/class as a compiled assembly, remove the source code and re-import the compiled assembly.
Now from your strategies, you can access this using the following syntax;
Print(NinjaTrader.NinjaScript.AddOns.SharedData.SomeIntValue);
I look forward to being of further assistance.
Leave a comment: