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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X