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 sam028 with 3 posts (5 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,832 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)

  #21 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395


supermht View Post
I got an indicator, it includes dll and cs...

is it safe to use it? I mean somebody might track my system?

thanks

@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.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #22 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

It is possible any DLL can steal any information from your computer, network, bank, trades, install a key logger, steal passwords, or anything else. You wouldn't know it if you can't view the source code.

Sent from my phone

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #23 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,168 since Jan 2013
Thanks Given: 57,452
Thanks Received: 26,278



supermht View Post
I got an indicator, it includes dll and cs...

is it safe to use it? I mean somebody might track my system?

thanks


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.


Big Mike View Post
It is possible any DLL can steal any information from your computer, network, bank, trades, install a key logger, steal passwords, or anything else. You wouldn't know it if you can't view the source code.

Sent from my phone

@supermht, all the above responses are correct. I would just add that either most or all commercial indicators will come in the form of dll files, as will some non-commercial ones. The reason is that the creator of the indicator does not want you -- or any competitor! -- to be able to read his original source code, and see just what the indicator does and so be able to copy it.

This puts you in the bind of having to trust the original author, and his or her motivations. It does not mean the dll's are inherently dangerous, just that you cannot know if they are or if they are not.

So, if you are going to buy an indicator, you are probably going to get a dll. You will need to decide whether the provider of the indicator is trustworthy, which you have to do every time you install any software on your computer anyway (essentially all commercial software will come as either exe or dll files, neither of which show the source code). You will need to be very careful who you trust if you are downloading indicators.

You will almost never see a dll allowed on futures.io (formerly BMT), which is about sharing, not hiding.

Bob.

Reply With Quote
Thanked by:
  #24 (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


symphys View Post
Thanks for the detailed tutorial.
Quick question about the usage: If the dll is recompiled and overwritten does NT need to be restarted or is a simple reload strategy enough to load the updated dll?

when a program (exe) is running, or when a library (dll) is loaded in memory, you will not be able to compile and overwrite the file (exe/dll), visual studio will give you a error it can not output to the locked file.

when you recompile a dll, make sure you unload the old version and reload the new version, it's a good habit to put a version number in your DLL, increment that number every time you modify and recompile, and output that to your output window, that way you can be sure the right version is loaded and you are testing against what you want to test

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #25 (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


supermht View Post
I got an indicator, it includes dll and cs...

is it safe to use it? I mean somebody might track my system?

thanks

If you have software (exe/dll) with uncertain/doubtful origin and you absolutely want to test it
(if it comes from a non respectful vendor i would strongly discourage you to install exe/dll, unless
you see the source code and are able to recompile it correctly, never take executables from
hacking site, they always include stuff you don't want on your system)

you can do a few things to limit your risk
1) you can always install software in a sandbox/virtual machine environment, if the software contains
a virus or other unwanted things, you will be able to contain the hazardeous behaviour to that sandbox
there are a lot of those environments out there. (vm ware, etc..)
2) if you don't have access to the source code and want to see what the software is doing, there a
few tools out that you can use :
- sniffer, is a program that allows to capture and visualize all packets that go in and out of your machine
this allows to see some of the network activity at least. (eg : ethereal, ..)
- you must of course always have a good end-node security product (anti-virus, malware detection)
- you can use a tool like filmon (system internals) to see what activity the module is generating on your
hard disk, if it is reading all files and directories on your disk, you might question what it's intent is)

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #26 (permalink)
laadari
morocco
 
Posts: 8 since Jun 2016
Thanks Given: 1
Thanks Received: 0

Hi;
I want integrate my own DLL file to an indicator in NinjaTrader 8. But NT crashed when I compile my code.

I tried to do like explained in this tuto: "https://nexusfi.com/ninjatrader-programming/32855-ninjatrader-dll-s-creating-loading-how.html"]https://nexusfi.com/ninjatrader-programming/32855-ninjatrader-dll-s-creating-loading-how.html" , but that didn't work. I tried also to use AddOns section and that didn't resolve the problem.

This is my code:


#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;

using MyLibrary;

using NinjaTrader.Cbi;
#endregion

namespace NinjaTrader.NinjaScript.Indicators
{
public class MyIndicator : Indicator
{
private Export export = new Export();
private List<string> symbolDetails;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{

}
else if (State == State.Configure)
{
Log("_____________---------------State = State.Configure---------------_____________", LogLevel.Information);

symbolDetails = new List<string>();
symbolDetails.Add(Instrument.MasterInstrument.Name);
symbolDetails.Add("CASH");
symbolDetails.Add("IDEALPRO");
symbolDetails.Add(Instrument.FullName.Substring(3, 3));
}
}

protected override void OnBarUpdate()
{

}

#region Properties
[Range(1, int.MaxValue)]
[NinjaScriptProperty]
[Display(Name="Period", Order=0, GroupName="Parameters")]
public int Period
{ get; set; }
#endregion

}
}


I need your help.

Reply With Quote
  #27 (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


laadari View Post
Hi;
I want integrate my own DLL file to an indicator in NinjaTrader 8. But NT crashed when I compile my code.

I tried to do like explained in this tuto: "https://nexusfi.com/ninjatrader-programming/32855-ninjatrader-dll-s-creating-loading-how.html"]https://nexusfi.com/ninjatrader-programming/32855-ninjatrader-dll-s-creating-loading-how.html" , but that didn't work. I tried also to use AddOns section and that didn't resolve the problem.

This is my code:


#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;

using MyLibrary;

using NinjaTrader.Cbi;
#endregion

namespace NinjaTrader.NinjaScript.Indicators
{
public class MyIndicator : Indicator
{
private Export export = new Export();
private List<string> symbolDetails;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{

}
else if (State == State.Configure)
{
Log("_____________---------------State = State.Configure---------------_____________", LogLevel.Information);

symbolDetails = new List<string>();
symbolDetails.Add(Instrument.MasterInstrument.Name);
symbolDetails.Add("CASH");
symbolDetails.Add("IDEALPRO");
symbolDetails.Add(Instrument.FullName.Substring(3, 3));
}
}

protected override void OnBarUpdate()
{

}

#region Properties
[Range(1, int.MaxValue)]
[NinjaScriptProperty]
[Display(Name="Period", Order=0, GroupName="Parameters")]
public int Period
{ get; set; }
#endregion

}
}


I need your help.

The example was created at the time that NT 8.0 was not yet out.
First thing that comes to my mind, is to check the .NET framework version.
To my knowledge NT 8.0 is using .net 4.5
For which version did you compile your DLL ?
Can you please check, correct and circle back if it solves ?

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #28 (permalink)
laadari
morocco
 
Posts: 8 since Jun 2016
Thanks Given: 1
Thanks Received: 0

Thinks for your replay,

I already check it and my library has for target .NET framework 4.5. And it's compiled with VS 2015.
I think that the problem have relation with the instantiation of the object export: private Export export = new Export();. Because sometimes when I comment this line, the indicator works.

Reply With Quote
  #29 (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

can you please post that object ?

I would suggest you comment out the maximum of the logic inside that object
and get also a try/catch in place if some stuff is there
make sure that the container works, purely the object without anything else

Do you rely on any other DLL's inside your object ?

Can you post a screen shot when exactly it crashes ?
Is there something in the event log ?
something in other log files ?

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #30 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395



laadari View Post
Thinks for your replay,

I already check it and my library has for target .NET framework 4.5. And it's compiled with VS 2015.
I think that the problem have relation with the instantiation of the object export: private Export export = new Export();. Because sometimes when I comment this line, the indicator works.

Is the issue when you compile or when you try to execute the Indicator?

Your DLL needs to be in the /bin/custom/ folder and usually requires a restart of NT8 for NT8 to link to the code for use so make sure you have restarted. This could be a simple "can't find DLL". Please check your Log & Trace files for any hints, if you post them we might be able to help better.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal 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