NinjaTrader and DLL's (creating and loading how-to) - NinjaTrader Programming | futures io social day trading
futures io futures trading


NinjaTrader and DLL's (creating and loading how-to)
Updated: Views / Replies:9,256 / 44
Created: by rleplae Attachments:18

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 18  
 
Thread Tools Search this Thread
 

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

  #31 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received

I wanna posted it but I must before that have more than 5 posts :'(
I tested my library in a simple console project and it's work verry well. This library use an other dll file to export historical data from an other plateform.

Reply With Quote
 
  #32 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received

ERROR: Unhandled exception: unable to read beyond the end of stream

Hello;

I want to work with a DLL file to export historical data from an other trading plateform. But I have the error message: "Unhandled exception: unable to read beyond the end of stream".

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


This is a part of code:

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

else if (State == State.Configure)
{
string connectionString = "Server=PCAM1;Database=NinjaTrader_ExportHistoricalData;User Id=sa;Password = n2Ls5kiKojV3839S37rT; ";
export = new ExportHD(connectionString);
Log("_____________---------------State = State.Configure---------------_____________", LogLevel.Information);

}
}


tected override void OnBarUpdate()
{
export.connect("127.0.0.1", 7496, 0);
try
{
export.exportHistoricalData(1, symbolDetails, EndDateTime, Duration, BarSizeSetting, WhatToShow, UserRTH, 1);
}
catch (Exception e)
{
Log("_____________---------------Exception message = " + e.Message + "---------------_____________", LogLevel.Information);
}
finally
{
export.disconnect();
}

}

I wish if you can help me to resolve that

Reply With Quote
 
  #33 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,503 since Sep 2013
Thanks: 1,706 given, 3,715 received
Forum Reputation: Legendary



laadari View Post
Hello;

I want to work with a DLL file to export historical data from an other trading plateform. But I have the error message: "Unhandled exception: unable to read beyond the end of stream".

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


This is a part of code:

I wish if you can help me to resolve that

I think this has more to do with a problem in the DLL itself, do you have the source code of that DLL ?
are you able to make it work correctly outside NT ?

Reply With Quote
 
  #34 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received


rleplae View Post
I think this has more to do with a problem in the DLL itself, do you have the source code of that DLL ?
are you able to make it work correctly outside NT ?

Yes of caurse, I tested it in a console project and it's work as I wish. The DLL file doesn't have any problem.

Reply With Quote
 
  #35 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,503 since Sep 2013
Thanks: 1,706 given, 3,715 received
Forum Reputation: Legendary


laadari View Post
Yes of caurse, I tested it and it's work as I wish. The DLL file doesn't have any problem.

Looks like inside the DLL you are trying to do some TCP/IP socket connection
and that fails, the exception is not properly caught

put

try
{
}
catch
{
}

in your code, inside the DLL, where you try to do things that you are not sure will work
like making a connection to something or reading a file

the stream should give you some clue...

Reply With Quote
 
  #36 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received


rleplae View Post
Looks like inside the DLL you are trying to do some TCP/IP socket connection
and that fails, the exception is not properly caught

put

try
{
}
catch
{
}

in your code, inside the DLL, where you try to do things that you are not sure will work
like making a connection to something or reading a file

the stream should give you some clue...

Thinks, I will tested it after.
I have also an ofher problem

Quoting 
Error on calling "OnbarUpdate" method on bar X: Object reference not set to an instance of an object


Reply With Quote
 
  #37 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received


rleplae View Post
Looks like inside the DLL you are trying to do some TCP/IP socket connection
and that fails, the exception is not properly caught

put

try
{
}
catch
{
}

in your code, inside the DLL, where you try to do things that you are not sure will work
like making a connection to something or reading a file

the stream should give you some clue...

I added the bloc try {} catch() {} but the error persiste

Reply With Quote
 
  #38 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,503 since Sep 2013
Thanks: 1,706 given, 3,715 received
Forum Reputation: Legendary


laadari View Post
I added the bloc try {} catch() {} but the error persiste

that means it does not wrap the code that generates the exception
sometimes you may be suprised where it comes from

Reply With Quote
 
  #39 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received

I had the same Stream error message (on NT8) while importing years of market replay data from NT7 but that was from a custom file-system and I think the error was coming from there (the file-system was too slow to handle NT8 queries). So maybe that's not relevant.
In this case it's maybe a threading issue, adding a
 
Code
                            
this.Dispatcher.InvokeAsync(() => {
   
blah blah blah;
  }
); 
may help.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following 3 users say Thank You to sam028 for this post:
 
  #40 (permalink)
Trading Apprentice
morocco
 
Futures Experience: None
Platform: ninjatrader
Favorite Futures: Currency futures
 
Posts: 8 since Jun 2016
Thanks: 1 given, 0 received



sam028 View Post
I had the same Stream error message (on NT8) while importing years of market replay data from NT7 but that was from a custom file-system and I think the error was coming from there (the file-system was too slow to handle NT8 queries). So maybe that's not relevant.
In this case it's maybe a threading issue, adding a
 
Code
                            
this.Dispatcher.InvokeAsync(() => {
   
blah blah blah;
  }
); 
may help.

Think you Sam;

When I tried it, I get the error message:

Error message
Indicator "MyCustomIndicator": Error on calling "OnBarUpdate" method on bar X: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall

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

Error message
Indicator "MyCustomIndicator": Error on calling "OnBarUpdate" method on bar X: Object reference not set to an instance of an object.

I hope you have a solution to that.

Reply With Quote

Reply



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

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use NTDirect.dll or NinjaTrader.Client in NinjaScript? vantojo NinjaTrader Programming 7 January 15th, 2014 06:39 AM
Interactive Brokers Gateway / Ninjatrader not loading weekly and monthly charts? luvs321 NinjaTrader 3 January 10th, 2014 02:05 PM
How-to remove .dll files from NinjaTrader PandaWarrior NinjaTrader 7 October 1st, 2012 08:21 AM
Please help creating a NinjaTrader Indicator jjl1753 NinjaTrader Programming 4 June 13th, 2011 10:26 PM
External DLL from Ninjatrader ehlaban NinjaTrader Programming 11 June 13th, 2010 12:42 PM


All times are GMT -4. The time now is 09:15 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-16 in 0.19 seconds with 20 queries on phoenix via your IP 54.83.122.227