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

Strategy code in external assembly

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

    Strategy code in external assembly

    Hi,

    I'm programing a system for graphicaly edit HCMS (Hierarchical concurency state machine) for edit easly differents strategies and test it for AutoTrading system., For this and because i'm encouter limitations with c# compilateur embeded with NinjaTrader, i'm using Visual studio 2012 for build the external assembly (im' using NLua for sripting system, http://gojs.net/latest/samples/orgcharteditor.html libs for java script for graphicaly edit the State Machine and more external lib who are not easy to use with NinjaTrader embede compilere (Nlua partialy working with NinjaTrader copiler, somme signature with default parameters disepears for sample...)

    But i have a probleme with custom type i'm making in both side, they are consideded as different type even if it's definied in c# source code compiled by NinjaTrader embeded compilater, and the same signature are considered as different type:

    ex:
    Strategy\StrategyInterface.cs
    Argument '1'*: impossible de convertir de 'IEngineNTInterface [c:\Users\asaff\Documents\NinjaTrader 7\bin\Custom\Strategy\StrategyInterface.cs(69)]' en 'IEngineNTInterface []' CS1503 - click for info 174 52

    I have the same probleme with all type definied in code, included interfaces, except for base type of c# like string, int, list etc...
    All Struct and classe type can't be used on the two side because considered as different by the Ninja embeded compiler (but no by Visual studio who can use the type defined in NinjaTrader without problems).

    Basicaly with this limitation, i'm can communicate from NinjaTradre strategy to external assembly, but not in reverse direction.

    So , ultimalty, i'm try to compile all with Visual studio, included the strategy base clase i'm writing in NinjaTrader side, Visual studio can generate the DLL with type imported from NinjaTrader like Indicator and Strategy, but when i'm import the compiled assembly with Visual Studio in Ninja Trader, i have this message when i'm try to use the strategy on a graph (the importing opération working without error)

    06/04/2016 21:35:14 Default Unable to retrieve type infos from assembly 'StrategyInterfaceExternNT': System.Reflection.ReflectionTypeLoadException: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
    à System.Reflection.Module._GetTypesInternal(StackCr awlMark& stackMark)
    à System.Reflection.Assembly.GetTypes()
    à NinjaTrader.Cbi.AssemblyDictionary.GetTypes(Type superClass)

    So what is missing for be able to compile a strategy with visual studio and import it in assembly for on NinjaTrader after ?

    For info, defininition of the base classe:

    /// <summary>
    /// Module d'interface pour les stratégies codées dans une assembly externe à NinjaTrader
    /// </summary>
    [Description("Module d'interface pour les stratégies codées dans une assembly externe à NinjaTrader")]
    public class StrategyInterface : Strategy, IOrderResult, IEngineIndicateur, IEngineNTInterface
    {
    ....

    and the classe StrategyInterface have variable instance of:

    private StrategyInterfaceExternNT.StrategyInterfaceExtern _ExternStrategyInterface;



    StrategyInterfaceExternNT.StrategyInterfaceExtern is the entry clas of assembly compiled by Visual studio 2012.

    I'm understand this subject is far of the scope of custom suport for progaming indicator and strategy, but if you can give me a direction, it's appreciated.

    Thanks if you can help me a little because i'm stuck with this probleme of incompatibilities of type between assembly compiled by NinjaTradre and Visual studio 2012 (all in .Net 3.5)


    Twanaar


    ps: after i'm plan porting this system in NinjaTrader 8, and perhaps sell it.
    Last edited by Twanaar; 04-06-2016, 08:06 PM.

    #2
    So, i'm found the solution:

    My project for the external DLL who include the class heriting of NinjaTrader.Strategy missing reference to WilsonORMapper DLL who are in program file/NinjaTrader7 instalation folder.

    So this solved my problem, and now i'm able to compile my strategy with visual studio 2012 and the external DLL too, without any problem of type compatibilities.

    In same time, i'm found we can compile directly NinjaTrader.Custom.dll with the csproj present in Documents/NT7/bin/Custom, but for don't have project convertion we must use Visual Studio 2010 (sp1) for stay able to open and compile that with NT7 embeded compiler, or duplicate the csproj with one for Visual Studio 2012.

    So i'm not need more help, but i'm point that they are a signature problem with embeded compiler for custom type (interface, class, struct...), the signature for the same class definition change between embeded compiler and Visual Studio 2012 (i'm don't known if the problem occur with Visual Studio 2012 sp1).
    Last edited by Twanaar; 04-08-2016, 07:09 AM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GLFX005, Today, 03:23 AM
    0 responses
    1 view
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    11 views
    0 likes
    Last Post XXtrader  
    Started by Waxavi, Today, 02:10 AM
    0 responses
    6 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    14 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    3 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Working...
    X