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 12-07-2005, 04:48 AM   #1
highflyer
 
Join Date: Dec 2005
Location: , ,
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

After generating a text file with Amibroker I get this message. What is wrong?

I think the text created has a space at the end. How can I prevent ninjatrader from "reading" that space as well?

This is my script:

Dim oWSH
Dim oArgs
Dim oFSO
Dim oFile

Dim i
Dim iResult
Dim sText


Const cstPathForAlertFile = "C:\Program Files\NinjaTrader 5\incoming\oif.txt"
Const cstScriptName = "orderscript"


Set oWSH = WScript.CreateObject("WScript.Shell")
Set oArgs = WScript.Arguments

If oArgs.Count > 0 Then

For i = 0 To oArgs.Count - 1
sText = sText & oArgs.Item(i) & " "
Next

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile= oFSO.CreateTextFile(cstPathForAlertFile, True)
oFile.WriteLine sText
oFile.Close
iResult = oWSH.popup("oif.txt file created", 3, cstScriptName, 64)
Else
iResult = oWSH.popup("No Command Line Params Passed!" & vbCrlf & "Alert File NOT Created",,cstScriptName, 16)
End If


set oFile = Nothing
Set oFSO = Nothing
Set oArgs = Nothing
Set oWSH = Nothing




This is the text file for ninjatrader:

PLACE;SIM101;FDAX 12-05;Sell;1;MARKET;0;0;Day;;;;

(there is as space at the end of this textfile)



highflyer is offline  
Reply With Quote
Old 12-07-2005, 07:18 AM   #2
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
Post imported post

You need to write out the text without (!) the trailing blank. Although I'm not familiar with AmiBroker I suggest the problem lies somewhere in

For i = 0 To oArgs.Count - 1
sText = sText & oArgs.Item(i) & " "
Next
NinjaTrader_Dierk is offline  
Reply With Quote
Old 12-07-2005, 11:34 AM   #3
highflyer
 
Join Date: Dec 2005
Location: , ,
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Dierk,



I can write : sText = sText & oArgs.Item(i) & " "


as: sText = sText & oArgs.Item(i) & "" (<note: no space)

but than also FDAX 12-05 is written as FDAX12-05 (also with no space)

I don't understand.Think I need a new script for Amibroker...(maybe)

greetz from Amsterdam

highflyer is offline  
Reply With Quote
Old 12-07-2005, 01:53 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Post imported post

Can you not write something that trims sText last space character? I am not familiar with what language Amibroker is based on but in .NET I could do something like:

sText.Remove(sText.Length - 1, 1)


NinjaTrader_Ray is offline  
Reply With Quote
Old 12-08-2005, 04:43 AM   #5
highflyer
 
Join Date: Dec 2005
Location: , ,
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Solved the problem with RTrim:

oFile.WriteLine RTrim(sText)

And now it works.Thanks

highflyer 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


All times are GMT -6. The time now is 12:29 AM.