Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to reference external library

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

    Unable to reference external library

    Hi,

    I have NinjaTrader 8.0.9.0 and I'm trying to reference the Redis library. I used NuGet in Visual Studio to download StackExchange.Redis v1.2.6 which installed the Redis library to bin/Custom/packages/StackExchange.Redis.1.2.6/lib/net45/StackExchange.Redis.dll

    I then used the following code in my NinjaScript

    using StackExchange.Redis;
    .
    ,
    .
    protected override void OnStateChange()
    {
    if(State == State.SetDefaults)
    {
    ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
    }
    }

    Basically I'm trying to establish a connection with my local Redis DB. The code compiles fine in NinjaScript Editor. However, when I open up the indicator window, I do not see the indicator listed and I get the following error message in the NinjaScript Output window.

    10/17/2017 23:13:57: Current State is State.SetDefaults
    10/17/2017 23:13:58: Current State is State.Configure
    Indicator 'SampleLevel2Book': Error on calling 'OnStateChange' method: Could not load file or assembly 'StackExchange.Redis, Version=1.2.6.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    Indicator 'SampleLevel2Book': Error on calling 'OnStateChange' method: Could not load file or assembly 'StackExchange.Redis, Version=1.2.6.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    Can you shed some light on how to resolve this issue please?

    Thanks,
    Clement

    #2
    Hello Clement,

    Welcome to the forums!

    We do not provide support for third party libraries so the amount of direction that we may provide will be limited.

    NinjaTrader 8 will require assemblies built with .NET 4.5 and these assemblies must have a reference added in the NinjaScript editor in order to function properly. These DLL's would have to match if you are using the 32 bit or 64 bit version of NinjaTrader.

    My colleague Jesse has put a video together demonstrating how you can create an external DLL and import it into NinjaTrader 7. The same steps can be taken using .NET 4.5 instead to create a DLL compatible with NinjaTrader 8.

    NinjaTrader_Jesse's post: https://ninjatrader.com/support/foru...91&postcount=4

    Adding References in NinjaTrader 8 can be done by following the guide here: https://ninjatrader.com/support/help...indicators.htm

    If these steps do not lead you toward a resolution, could you provide a minimal example of a NinjaScript that uses this DLL along with the DLL so I can test on my end? A barebones example similar to what Jesse has shared would be ideal for us to provide further input.

    We look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

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