NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM 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 12-05-2007, 04:16 PM   #1
EvolveK
Junior Member
 
Join Date: Sep 2007
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default Continued: Automated Trading German Stocks

Hi,

this refers to the discussion from yesterday - the suggested solution using NT 6.5beta does not make a difference.

I am still getting the following error message:

12/6/2007 12:09:15 AM,Strategy,The strategy 'DataLoad' has called the Add() method with an invalid instrument. Either 'DBK' does not exist in the Instrument Manager or the specified exchange has not been configured.

I am already trading the NDX100 without any problems. Everything is configured the same way for the German stocks, except for the Exchange (Xetra).

This issue has to be solved quickly as it is preventing trading a profitable strategy for 3 days now. Please refer to the thread from Tuesday
[Ticket #46550] / "Running a Strategy on German Stocks with Interactive Brokers"


Thanks
Martin
EvolveK is offline  
Reply With Quote
Old 12-05-2007, 04:40 PM   #2
EvolveK
Junior Member
 
Join Date: Sep 2007
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default Code Snippets regarding Trade Automation Problem

There is a notable difference from NT6.5 vs. 6.0 though:
when displaying a chart with one of the German instruments using Xetra as exchange, this triggers a data request to Interactive Brokers. I guess this means that my instrument list for the HDAX stocks seems to be fine. Hence the problem must lie in the way in which the strategy accesses the data.

The respective strategy is used simply to trigger a historical data request for IB (I have separated that from the actual strategy in order not to trigger IBs limitations on historical data requests), and is working perfectly fine for NDX100 stocks:

In the "Strategy" tab, it is simply called using the MarketListIdx Number referring to lists of symbols defined in UserDefinedMethods:


Definition of Customer MarketLists in UserDefinedMethods
public string[][] MarketLists = {
new string[] {"AAPL", "ADBE", "ADSK", "AKAM"},
new string[] {"ADS", "ALV", "DBK", "DAI"}
};

Complete Code of 'DataLoad' Strategy
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Does nothing, except loading data from IB
/// </summary>
[Description("Does nothing, except loading data from IB")]
[Gui.Design.DisplayName("Data Load Strategy")]
public class DataLoad : Strategy
{
#region Variables
// Wizard generated variables
private int marketListIdx = 0; // Default setting for MarketListIdx
private int lookbackLength = 390; // Default setting for LookbackLength
// User defined variables (add any user defined variables below)
string[] marketList;
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
// Sanity Check
if( marketListIdx < 0 || marketListIdx >= MarketLists.Length )
{
Print("Invalid marketListIdx");
return;
}
// Market initialization
marketList = MarketLists[marketListIdx];
for( int i=0; i<marketList.Length; ++i )
{
Log("Using Instrument " + marketList[i],NinjaTrader.Cbi.LogLevel.Information);
Print("Adding " + marketList[i]);
Add(marketList[i],PeriodType.Minute,1);
}

// Set further Ninja configuration variables
DataSeriesConfigurable = false; // this doesn't seem to have any effect so we just ignore
// the manually assigned data series
CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
double x = SMA(LookbackLength)[0];
}


#region Properties
[Description("Choose Symbol List")]
[Category("Parameters")]
public int MarketListIdx
{
get { return marketListIdx; }
set { marketListIdx = Math.Max(0, value); }
}

[Description("Length of Data Download")]
[Category("Parameters")]
public int LookbackLength
{
get { return lookbackLength; }
set { lookbackLength = Math.Max(390, value); }
}
#endregion
}
}
EvolveK is offline  
Reply With Quote
Old 12-05-2007, 10:21 PM   #3
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Sent you PM.
NinjaTrader_Dierk 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
Trading Australian Stocks? Antraman Connecting 34 12-07-2009 11:28 PM
The power of automated trading chipper338 Automated Trading 26 04-08-2009 10:52 AM
Running a Strategy on German Stocks with Interactive Brokers EvolveK Automated Trading 17 12-04-2007 05:53 AM
If I only have Ninjia and I.B. TWS ,can I do automated trading joesan Automated Trading 7 08-15-2007 08:29 AM
Automated Trading Travis Automated Trading 2 10-10-2005 07:59 AM


All times are GMT -6. The time now is 07:43 PM.