Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error CS0433 when exporting a strategy

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

    Error CS0433 when exporting a strategy

    Hi,

    when I export my strategy I get an error CS0433.
    Error compiling export assembly: c:\users\myuser\documents\NinjaTrader 8\bin\Custom\Strategies\MyStrategy. cs(20,11) : error CS0433: The type 'NinjaTrader.NinjaScript.Indicators.EMA' exists in both 'c:\users\myuser\documents\NinjaTrader 8\bin\Custom\NinjaTrader.Vendor.dll' and 'c:\users\myuser\documents\NinjaTrader 8\bin\Custom\MyIndicator.dll'

    ​The situation is the following:
    1. I have a custom indicator (MyIndicator) that uses the EMA standard indicator. When I export this indicator the compiler gives me a message that @EMA.cs is added to the dll.
    2. I install the indicator at the NinjaTrader environment where I develop my strategy.
    3. When exporting my strategy, I add the reference to MyIndicator. After pressing Export I get the error CS0433.

    I wonder how to solve this problem?
    When I create the MyIndicator.dll I have no option to leave out the @EMA.cs.
    On the other side I have to add the reference to MyIndicator when I export the strategy to ensure that it works.

    Any suggestions on how I can overcome this dilemma?

    Thanks !!!
    Armin
    Last edited by Armin; 06-13-2023, 09:16 AM.

    #2
    Hi Armin, thanks for posting. I tested using the attached files and do not get this issue. There must be some way you are using the indicator that is causing a compile error on your end. Please see attached for my example.

    I posted a .zip fo the UseEMA indicator as source and I also uploaded the host strategy .cs file.

    1. Import UseEMASource
    2. Export this as a compiled assembly.
    3. Exclude UseEMA from compilation by right clicking it from the Editor window>Exclude From Compilation
    4. Import the newly created UseEMA.dll
    5. Add in the HostStrategy.cs file into Documents\NinjaTrader 8\bin\Custom\Strategies, then compile.
    6. Export the HostStrategy as a DLL. Note, I did not have to add the UseEMA as an additional reference, it will do it automatically.
    Attached Files

    Comment


      #3
      Hi Chris,

      thank you for testing this issue.
      With your example I recognized, that I forgot to mention that I also use the standard EMA in the strategy.
      Just declare in HostStrategy at line 31:

      private EMA StdEMA;

      You can compile the strategy without problems.
      But now when you try to export it and have a reference to UseEMA, then the error CS0433 will come up and you can not export the HostStrategy.

      Thanks !!!
      Armin

      Comment


        #4
        Hi, Please make sure when you are exporting the Strategy that also uses the EMA, add the EMA system indicator to the list of exports

        Comment


          #5
          Hi Chris,

          I would have never come up with that.

          Thank you for your valuable support !!!
          Armin

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          91 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          31 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          69 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X