Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compiling assembly but not included indicators

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

    Compiling assembly but not included indicators

    Hello NinjaTrader

    I have created strategy "ChartTrader" that i wish to export as a compiled assembly.
    In this ChartTrader i have used a whole lot of NT standard Indicators and Opensource indicators from ex. UserAppShare. that can be used for differant things eg, targets, stops, sizings, trends etc,,,

    All the indicators are addded like this example for a standard EMA.


    private EMA FiltersEMAInd;

    "StateDataLoaded"
    FiltersEMAInd = EMA(Close, FiltersEMAPeriod);
    FiltersEMAInd.Plots[0].Brush = Brushes.Goldenrod;
    FiltersEMAInd.Name = string.Empty;
    AddChartIndicator(FiltersEMAInd);​


    When i export my "Strategy" it wants to include all the indicators i have used and as such this is fine and works fine.


    However it exports al these indicators alos as Compiled assemblys, is it not possible to just include them as non compiled assemblys ?
    or just Exclude them form the Export, and require the user to have the indicator already avalible on their PC ?

    for the Standard NinjaTrade Indicators this it not so much a problem but if i use a OpenSource indicator i dont what to include it as a compiled version.

    Also this is giving issues when a user then already have a non Compiled version of the indicator already on their PC.


    Or is this how it should be and how everyone is doing it ?
    Donto
    NinjaTrader Ecosystem Vendor - otrading.dk

    #2
    Hello donto,

    Export the non-system open source indicators as an assembly first.

    Then exclude these from compilation and import the assembly.

    Export the strategy referencing the assembly.

    Below is a link to a video of this.


    With the exported .zip, edit the info.xml file to remove the reference to the assembly.

    Optionally, remove the indicator assembly and re-include the open source indicators for compilation.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea

      Thanks you for the reply,
      Great with the video, thank you.

      I will give it a go,
      i might want to just create a VM where i compile everything on, it seems when having many many indicators and strategies referancing left and right this exclude and import gets a bit complicated.

      Is there no reature request to be able to referance non compiled assemblies. or something else that would makes this more simple to manage ?




      Last edited by donto; 12-12-2024, 03:34 AM.
      Donto
      NinjaTrader Ecosystem Vendor - otrading.dk

      Comment


        #4
        Hello Chelsea

        I have been strugeling all day to try and compile this but keep getting this error.

        Is there any way to get a log or print of what it is it thinks it is missing.


        Click image for larger version

Name:	billede.png
Views:	42
Size:	3.7 KB
ID:	1327578
        Donto
        NinjaTrader Ecosystem Vendor - otrading.dk

        Comment


          #5
          Finally, Dont know why compiling took also 1-2 hours in the end.
          Ended up Re-installing NT 100% clean of everything and started from scratch.

          Exported as needed and in a matter of seconds, Thank you for the help.
          Donto
          NinjaTrader Ecosystem Vendor - otrading.dk

          Comment


            #6
            Hello Chelase

            so when i have a working compiled version i want to remove / replace the compiled version of the opensource indicator.

            in my reference file i have this line.
            *MyDocuments*\NinjaTrader 8\bin\Custom\AuSuperTrendU11.dll
            If i have the opensource version installed i can import this correct but i comes with this error.
            Default Strategy 'OT_ChartTrader': Error on calling 'OnStateChange' method: Could not load file or assembly 'AuSuperTrendU11, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified


            If i try to import it it requires me to have the compiled version installed.

            The OpenSource version is located here.
            *MyDocuments*\NinjaTrader 8\bin\Custom\Indicators\AuSuperTrendU11.cs'

            If i replace the line in referaqnces
            I am getting this error.

            Default Error compiling import assembly: error CS0009: Metadata file 'C:\Users\donto\Documents\NinjaTrader 8\bin\Custom\Indicators\AuSuperTrendU11.cs' could not be opened -- PE image doesn't contain managed metadata.


            If i instead remove the line i can import the assembly with no issues how ever when i open strategies it complains that it cannot find it

            Default Strategy 'OT_ChartTrader': Error on calling 'OnStateChange' method: Could not load file or assembly 'AuSuperTrendU11, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified

            .

            ​So how can i now remove the dependency to the compiled version of this opensource indicator and just use the OpenSource version is already installed.
            Last edited by donto; 12-12-2024, 06:04 PM.
            Donto
            NinjaTrader Ecosystem Vendor - otrading.dk

            Comment


              #7
              Hello donto,

              May I confirm you have followed the steps from post # 2?

              "With the exported .zip, edit the info.xml file to remove the reference to the assembly."

              May I confirm you are not attempting to change the reference to a non-assembly file and that you have removed the reference as directed?

              To confirm the assembly is referencing classes from the open source script?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello Chelsea
                again thank you for your time.

                Yes, so i am using AuSuperTrendU11.cs in my strategy.
                I start by exporting this file as a compiled assembly.

                I then Exclude the source file and strategy from compilation
                I then import the compiled assembly.
                I then enable the strategy files for compilation again.

                I then export the strategy as compiled assembly and adding the referance to the intocators AuSuperTrendU11.

                I now have this in my info.xml so there are no referances in this file.

                <?xml version="1.0" encoding="utf-8"?>
                <NinjaTrader>
                <Export>
                <Version>8.1.4.0</Version>
                <Agile>6.9.1.8</Agile>
                </Export>
                </NinjaTrader>​

                And this in my referances.txt

                *MyDocuments*\NinjaTrader 8\bin\Custom\OT_PriceOscillator.dll
                *MyDocuments*\NinjaTrader 8\bin\Custom\OT_vWAP.dll
                *MyDocuments*\NinjaTrader 8\bin\Custom\AuSuperTrendU11.dll

                ​The bottom referance i then remove.


                on another PC, i import the Free Open source of the AuSuperTrendU11 witch the gives me the file AuSuperTrendU11.cs and all of its dependencies.
                I import the two other referances i have in my referance file.

                i then import the Strategy.

                But when i try to go to stretegys menu i get this error.

                Time Category Message
                16-12-2024 19:43:43 Default Strategy 'OT_ChartTrader': Error on calling 'OnStateChange' method: Could not load file or assembly 'AuSuperTrendU11, Version=1.3.0.9, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.


                Am i missing a part or am i doing something wrong or have i misinderstood a part ?

                Donto
                NinjaTrader Ecosystem Vendor - otrading.dk

                Comment


                  #9
                  Hello donto,

                  When I gave this a test earlier for my initial reply, I hadn't restarted NinjaTrader after importing the assembly and wasn't getting that message.
                  The strategy was able to use the open source script without any issue.
                  This time I did restart after importing the indicator assembly and now I am seeing the same message about the missing dependency, so the steps I provided is not a proper procedure.

                  I'll have to check with our development to see if this is possible. Once I have more information I will follow up.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Hello donto,

                    A member of our development has let me know the strategy assembly points to an assembly reference in a tree which is causing the error even though the source form is available.

                    Unfortunately, there does appear to be a workaround for specifically referencing a class in an open source script we can find.

                    Instead, we would recommend making a copy of the open source indicator with a new unique name and including this as an assembly (either referenced or bundled).
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by leunating, Today, 12:56 AM
                    2 responses
                    17 views
                    0 likes
                    Last Post leunating  
                    Started by tmk-c, 07-19-2017, 11:29 PM
                    6 responses
                    1,687 views
                    0 likes
                    Last Post Brightredmegaphone  
                    Started by Trader4Life, Today, 09:20 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post Trader4Life  
                    Started by WileCoyote, Today, 08:26 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post WileCoyote  
                    Started by madankumars, 11-18-2019, 11:12 AM
                    10 responses
                    176 views
                    0 likes
                    Last Post ulisesguerrero  
                    Working...
                    X