NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 06-20-2012, 04:26 PM   #1
greed999
Member
 
Join Date: Jun 2011
Posts: 42
Thanks: 24
Thanked 0 times in 0 posts
Default NTDirect.dll and MarketData function(+)

Hello everyone

Got a small problem. Having imported NTDirect.dll faced an interesting issue. Tying to call Market data results in an error: Couldn't load type ... because the method 'MarketData' has no implementation (No RVA). Any ideas? Thanks in advance. The code is below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using MySql.Data.MySqlClient;
using System.IO;
using System.Runtime.InteropServices;

namespace test1
{
class Test
{
[DllImport("NTDirect.dll")]
public extern static int Connected(int showMessage);
public extern static int SubscribeMarketData(string instrument);
public extern static double MarketData(string instrument, int type);
}

public partial class Form1 : Form
{
private MySqlConnection conn;
public Form1()
{
InitializeComponent();
log(Test.Connected(11111).ToString());
log(Test.SubscribeMarketData("ZB").ToString());
log(Test.MarketData("ZB",1).ToString());
}
public void log(string txt)
{
outtxt.Text = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss") + " " + txt +
Environment.NewLine + outtxt.Text;
}
}
Last edited by greed999; 06-20-2012 at 06:14 PM.
greed999 is offline  
Reply With Quote
Old 06-20-2012, 06:16 PM   #2
greed999
Member
 
Join Date: Jun 2011
Posts: 42
Thanks: 24
Thanked 0 times in 0 posts
Default

Figured out, had to add [DllImport("NTDirect.dll")] before declaration of each function.

Another issue: market data returns "0" instead of proper quotes. However connected and subscribe functions seem to have succeded (but they also return "0"). NT 7 is up and running. Flag AT is on. Have I missed something? Any help appreciated. Thanks in advance.
Last edited by greed999; 06-20-2012 at 06:23 PM.
greed999 is offline  
Reply With Quote
Old 06-20-2012, 06:50 PM   #3
greed999
Member
 
Join Date: Jun 2011
Posts: 42
Thanks: 24
Thanked 0 times in 0 posts
Default

Solved) Had to put "ZB 09-12" as a contract name.))
greed999 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot reference NTDirect.dll Taniwha Connecting 5 01-14-2013 07:03 AM
NTDirect.dll Orders() function Jaba1n Automated Trading 13 06-02-2012 08:35 PM
Incompatible NTDirect.dll sdruley Automated Trading 3 04-18-2012 10:41 AM
NtDirect.dll Command function in Delphi Pasado Miscellaneous Support 10 04-26-2009 06:31 PM
Dll Interface MarketData Futures_Shark Automated Trading 3 04-20-2008 04:38 PM


All times are GMT -6. The time now is 11:26 PM.