NinjaTrader Support Forum  

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 04-07-2008, 01:35 PM   #1
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Anyone using E-Signal EFS to AutoTrade FX?

Just curious who is out there doing this? I have full blown E-Sig since the E-Signal FX charts do not support running efs. I have a program I have been autotrading futures with, that I converted from esig->DynaOrder->IB to esig->NT but trading FX instead. Today was my first day that I gave my script a whirl, so I should have some results by the end of tomorrow.

My question to the community, is there any one out there doing this exact same thing? Was just looking for a potential reference if I ran into issues.

Also, for the NT guys reading this, your E-Sig sample code on your website has tons of syntax errors in it. I cleaned it up to run in my script and when I am ready, I can post the live order logic if anyone is interested.

Regards,

Thomas.
arbifox is offline  
Reply With Quote
Old 04-07-2008, 02:33 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Thomas,

If our sample has some syntax erorrs, would appreciate (if possible) a corrected version.

Thanks
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-07-2008, 03:27 PM   #3
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Corrections

Ray,

The following were not correct. Just look on the "eSignal Sample Code" page at http://www.ninjatrader-support.com/H....html?Overview:

// Place a buy stop order. "orderId" is optional (set to "" it not applicable).
function NTBuyStop(orderId, quantity, stopPrice) {
return NTCommand("Place", "", "Buy", quantity, "Stop", 0, stopPrice, "", "", orderId, "", "");
}

and:

// Get a string of order IDs of all stop orders of a strategy separated by '|'.
function NTStopOrders(strategyId) {
return dll.call("StopOrders", strategyId);
}

I also declared the following in the beginning of my script, otherwise you get undeclared variable errors:

// NT VARIABLE DECLARATIONS
var account=0;
var orderId=0;
var quantity=0;
var limitPrice=0;
var stopPrice=0;
var name=0;
var strategyId=0;

The one question I am still not certain about is whether or not you need to declare the account variable? When would you ever be trading multiple accounts on one connection? The connection to my GAIN account is declared in the Connection config, so I am not sure how I would be able to route an order to another account through that connection?

One other matter while I am thinking about it. I am on the Simulation Mode after entering my GAIN production account info. If I take NT off of the Simulator state, I trust that is all that is needed to route my orders live to the market?

I will be running my script again tomorrow and I should be able to get further, if there is anything else I notice, I will post a note.

Regards,

Thomas.
arbifox is offline  
Reply With Quote
Old 04-07-2008, 11:31 PM   #4
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

On the EFS sample script issues:
- please make sure you are on latest 6.5.1000.1 (see download page)
- copy <program files>/NinjaTrader6.5/binAutoTrade/NTSample.efs to <eSignal installation folder>/Formulas/Download)
- start eSignal and NT
- in eSignal: Right click on chart->Formulas->Download->NTSample

Where exactly do you now see messages which make you believe there are script syntax issues?
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-08-2008, 12:21 PM   #5
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Testing Results

The errors in syntax I saw on the web-page version of EFS samples. I tested the version of the script that came with NT 6.5. I am using E-Sig version 8.0 (07/2006 Build - I have the version number at home).

In terms of testing, I started E-Sig, started NT. I then opened a 1-minute standard chart on the JPY/USD pair. The e-sig symbol is "JPY A0-FX". I took the sample script that was in the AutoTrade folder, and loaded the script into the chart.

Looking at the logs in NT, this is what I see:

4/8/2008 10:16:16 AM ATI OIF, 'Place;;JPY A0-FX;Buy;1;Market;0;0;;;MyOrderId;;' holds unknown instrument 'JPY A0-FX'

When I place an order straight from the front-end of NT, this is what a normal order looks like:

4/8/2008 10:27:33 AM Connection GAIN: Primary connection=Connected, Price feed=Connected
4/8/2008 10:28:10 AM Order Submitting order without strategy...
4/8/2008 10:28:10 AM Order Order='2151b5210f8f4504b81a14dbcb462b75/Sim101' Name='' New State=PendingSubmit Instrument='$USDJPY' Action=Buy Limit price=102.47 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
4/8/2008 10:28:10 AM Order Order='2151b5210f8f4504b81a14dbcb462b75/Sim101' Name='' New State=Accepted Instrument='$USDJPY' Action=Buy Limit price=102.47 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
4/8/2008 10:28:10 AM Order Order='2151b5210f8f4504b81a14dbcb462b75/Sim101' Name='' New State=Working Instrument='$USDJPY' Action=Buy Limit price=102.47 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
4/8/2008 10:29:59 AM Order Order='2151b5210f8f4504b81a14dbcb462b75/Sim101' Name='' New State=Filled Instrument='$USDJPY' Action=Buy Limit price=102.47 Stop price=0 Quantity=1 Type=Limit Filled=1 Fill price=102.47 Error=NoError Native error=''
4/8/2008 10:29:59 AM Execution Execution='4baf648ec7a14283bcfc903fdd3df555' Instrument='$USDJPY' Account='Sim101' Exchange=Default Price=102.47 Quantity=1 Market position=Long Operation=Insert Order='2151b5210f8f4504b81a14dbcb462b75' Time='4/8/2008 10:29:59 AM' Multiplier=100 Rate=0.00976276481499561
4/8/2008 10:29:59 AM Position Instrument='$USDJPY' Account='Sim101' Avg price=102.47 Quantity=1 Market position=Long Operation=Insert Currency=Unknown

The other issue is that when I unload the script from the chart, E-Sig crashes, with message and all. I am wondering if this functionality is only supported after a certain version of e-sig? I can tell you that I went through several version of e-sig with DynaOrder, and never had a dll issue that was version dependent.

Is there not some type of a need to pass a symbol along with the call that can be decyphered by NT? I was told that it should read it from the chart.

Let me know what I am doing wrong, and thanks for all assistance.

Regards,

Thomas
arbifox is offline  
Reply With Quote
Old 04-08-2008, 12:48 PM   #6
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

Please see my post below: Where exactly do you now see messages which make you believe there are script syntax issues?

>> 'Place;;JPY A0-FX;Buy;1;Market;0;0;;;MyOrderId;;' holds unknown instrument 'JPY A0-FX'
NT is unable to map this instrument to the NT internal "$USDJPY". I suggest changing the sample script to explicitly stuff in "$USDJPY" instead of the generic "getSymbol()".

On the crash: Sorry I don't know. You would need to contact eSignal for clarification. I noticed that eSignal sometimes crashes even without any NT script.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-08-2008, 02:13 PM   #7
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax Errors

Dierk,

The syntax errors are from the online-documentation on the NinjaTrader site, under esignal Integration->Sample Code, and NOT from the installation scripts which come with the install:

// Place a buy stop order. "orderId" is optional (set to "" it not applicable).
function NTBuyStop(orderId "Buy", quantity, "StopLimit", limitPrice, stopPrice, "", "", orderId, "", "");
}

// Get a string of order IDs of all stop orders of a strategy separated by '|'.
function NTStopOrders(strategyId) {
return dll.call("StopOrders", strategyId);

I am still not sure why it is crashing, has anyone tested this for use with FX?

Regards,

Thomas.
arbifox is offline  
Reply With Quote
Old 04-08-2008, 09:31 PM   #8
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

Where exactly do you see syntax errors?
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-09-2008, 07:26 AM   #9
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax Corrections

The functions below should be written as the following:

// Place a buy stop order. "orderId" is optional (set to "" it not applicable).
function NTBuyStop(orderId, quantity, stopPrice) {
return NTCommand("Place", "", "Buy", quantity, "Stop", 0, stopPrice, "", "", orderId, "", "");
}

// Get a string of order IDs of all stop orders of a strategy separated by '|'.
function NTStopOrders(strategyId) {
return dll.call("StopOrders", strategyId);
}

There were missing commas, brackets and such. Once again, this was NOT from the attached script in the bin/autotrade folder, rather on your website.

Aside of the syntax issues, can someone please just examine the proper symbol parameter passing from E-Signal charts to NT? I have not tested this with futures, as I am using this application for FX with Gain.

The issue is that the E-Sig Symbol of JPY AO-FX is not getting translated to something that NT can understand, such as $USDJPY. Is there some mapping that needs to be set?

I assume all of this was tested somewhere, so it should be just a configuration issue.

Regards,

Thomas.
arbifox is offline  
Reply With Quote
Old 04-09-2008, 07:29 AM   #10
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

>> this was NOT from the attached script in the bin/autotrade folder, rather on your website.
To clear up the confusion: could you post a link on where you saw this so we could fix it? Thanks

On the symbol name itself: Please see my post below, you would need to change the script and hard code the symbol name instead of going with "getSymbol()". Thanks
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-09-2008, 07:42 AM   #11
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Got it, thanks for reporting the syntax error. Will resolve immediately on online help guide.
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-09-2008, 07:47 AM   #12
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Link to Web Page

http://www.ninjatrader-support.com/H....html?Overview

Because you are using frames, I can not isolate the actual URL to the final page.

Just follow:
Automated Trading -> esignal Integration -> Sample Code

Also, will the following section below ever be finished:
Automated Trading -> esignal Integration -> Set Up

I am going through extensive testing right now, just let me know if you need a volunteer to send you notes on issues encountered.

Thanks for the correction, I will test as soon as I can.

Regards,

Thomas.
arbifox is offline  
Reply With Quote
Old 04-09-2008, 07:49 AM   #13
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

Thanks for this info. We'll look into.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-16-2008, 06:06 PM   #14
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default But why does E-Signal Crash?

Dierk or anyone else . . .

I did as suggested and I managed to get an order placed from the sample script to NT, clicked off the confirm order so it goes through automatically, but the one strange thing is that E-Signal crashes if you unload the script. Matter of fact, it crashes no matter what you do. Is this a side effect of the NTSample script, or some undocumented functionality . . . hope not

Has any of the NT admin staff experienced this behavior when developing the software?

I plan to test an entire end to end script next week, but I am just wondering if I need to update E-Sig. I am on build 782 (7/20/2006).

Let me know . . .

T
arbifox is offline  
Reply With Quote
Old 04-16-2008, 07:27 PM   #15
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

I do know that some eSignal scripts can crash eSignal. This is something that is an issue with eSignal as it should be able to handle script errors gracefully. We have no problems nor any reported problems with the provided sample script.
NinjaTrader_Ray 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
Evaluation version-new user- ts/ib autotrade jsl12 Automated Trading 1 04-02-2008 11:23 AM
NT out of sync with e-signal djayw SuperDOM and other Order Entry Windows 1 01-31-2008 06:44 AM
Need 2 Kwikpop Indicators Programmed for Autotrade 123r34 Automated Trading 1 01-26-2008 07:53 AM
Autotrade using excel gregw Automated Trading 0 10-03-2006 09:03 AM
Reverse on autotrade biswar Automated Trading 1 06-15-2005 06:04 AM


All times are GMT -6. The time now is 05:59 AM.