NexusFi: Find Your Edge


Home Menu

 





NinjaTrader and DLL's (creating and loading how-to)


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one rleplae with 16 posts (87 thanks)
    2. looks_two laadari with 10 posts (0 thanks)
    3. looks_3 NJAMC with 6 posts (15 thanks)
    4. looks_4 ratfink with 3 posts (8 thanks)
      Best Posters
    1. looks_one rleplae with 5.4 thanks per post
    2. looks_two ratfink with 2.7 thanks per post
    3. looks_3 NJAMC with 2.5 thanks per post
    4. looks_4 sam028 with 1.7 thanks per post
    1. trending_up 29,301 views
    2. thumb_up 121 thanks given
    3. group 23 followers
    1. forum 45 posts
    2. attach_file 18 attachments




 
Search this Thread

NinjaTrader and DLL's (creating and loading how-to)

  #41 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


laadari View Post
Think you Sam;

When I tried it, I get the error message:


And when I use "try catch", I get:


I hope you have a solution to that.

These errors are too generic, it's impossible to debug without the sources and the .dll.

If your goal is to upload Ninja data to your own DB from an indicator it might be quicker to write something which is reading the Ninja SQLCE database...

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
Better Renko Gaps
The Elite Circle
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #42 (permalink)
MD855
hartford, ct
 
Posts: 3 since Dec 2016
Thanks Given: 2
Thanks Received: 1

Thank you rleplae for the great tutorial! I searched online for hours before I found your post from 2014! Just what I was looking for. Two questions I hope you're still around to help with

1. Is there anyway to use a DLL without putting it in C:/Documents/NinjaTrader 7/bin/Custom? I want my ninjascript to run a function without making it "part" of ninjatrader.

2. Lets say that in your example, ClassLibraryBMT was written in C++. Would it still be possible to use as you outline? Maybe with something involving interopservices?

Reply With Quote
  #43 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863



MD855 View Post
Thank you rleplae for the great tutorial! I searched online for hours before I found your post from 2014! Just what I was looking for. Two questions I hope you're still around to help with

1. Is there anyway to use a DLL without putting it in C:/Documents/NinjaTrader 7/bin/Custom? I want my ninjascript to run a function without making it "part" of ninjatrader.

2. Lets say that in your example, ClassLibraryBMT was written in C++. Would it still be possible to use as you outline? Maybe with something involving interopservices?

1. What is the type of service your module needs to do deliver ?

I have built for example algo services that i call from an indicator container through a JSON call, then service then delivers a chunk of data, so inside NT i can use that data to draw on the screen. Another example is call that back-end where i pass orderIDs and the back-end is then managing the stops in an intelligent way or rejects the order simply if it does not pass the rules of my risk engine

2. Yes that is possible, you can have external libraries that are not c# and not inside the NT directory, and example is this piece of code :

 
Code
			
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #44 (permalink)
MD855
hartford, ct
 
Posts: 3 since Dec 2016
Thanks Given: 2
Thanks Received: 1

I have a lot of computational stuff I've done in C++, and want to use the functions in NT.

For simplicity, let's pretend ClassLibraryBMT.dll was in C++ and has the path 'C:\ClassLibraryBMT.dll'. If I simply wanted to call BMTmethod() in my NT script without re-writing it in C# and without copying to the /Bin/Custom folder, how would I do that?

Reply With Quote
  #45 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


MD855 View Post
I have a lot of computational stuff I've done in C++, and want to use the functions in NT.

For simplicity, let's pretend ClassLibraryBMT.dll was in C++ and has the path 'C:\ClassLibraryBMT.dll'. If I simply wanted to call BMTmethod() in my NT script without re-writing it in C# and without copying to the /Bin/Custom folder, how would I do that?

See How to call C++ DLL in C# - Stack Overflow for your first question.
See .net - How to set C# library path for an application? - Stack Overflow if you don't want to put your .dll in the GAC nor in the NT directory.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #46 (permalink)
xtrf
Nantes+France
 
Posts: 1 since Oct 2020
Thanks Given: 0
Thanks Received: 0


NJAMC View Post
@supermht,

You have already stated most of the risk, make sure you know who make the DLL and what their intension is with the program. If you just download random DLLs, you are at risk. futures.io (formerly BMT) generally doesn't allow DLLs for download except in rare circumstance because of the safety/security issues.

Great post

Reply With Quote




Last Updated on December 4, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts