View Full Version : Forex.com programmer here with a getting started question
rpiller
09-23-2010, 12:02 PM
I already have a forex.com account and have been trading forex for a few months. I use a signal service that sends me emails of signals and I have a program to read the emails. The data they provide is the pair, if it's buy/sell, at what enter rate, and a stop/limit for the trade. I would then run my own code each day to figure out what pairs to trade based on my own strat and when I get those signals make the trades. It seems like I would be able to make those trades using ninja trader?
I'm working with forex.com to get my ninja trader account setup with them, but as far as the api goes with making these kind of If Then OCO trades, I was hoping someone could point me in the right direction.
NinjaTrader_Brett
09-23-2010, 12:22 PM
Hello,
Thank you for your forum post.
To clarify your asking on how you would go about coding NinjaTrader to submit OCO orders based on conditions? Are you wanting OCO for your profit target or stop loss or for your entry orders or both?
I look forward to assisting you further.
rpiller
09-23-2010, 04:31 PM
To clarify your asking on how you would go about coding NinjaTrader to submit OCO orders based on conditions?
Correct, but those conditions are not based on rates. They are outside conditions to the market data itself. I get signals emailed to me, and I want to place orders based on those emails. I already have the coding to pull the emails automatically out so I have them to work with. So maybe I can use the scripting with Ninja Trader to read these from a file or database, and have the Ninja Trader scripting enter the deals based on that?
Are you wanting OCO for your profit target or stop loss or for your entry orders or both?
I want an If Then OCO. If the buy/sell rates hits x, get into the deal with y stop loss and z limit.
NinjaTrader_RyanM
09-23-2010, 04:47 PM
You may be interested in Advanced Trade Management. This allows you to apply target and stop losses to orders that are automatically applied upon entry execution. These orders are OCO with no additional configuration needed.
See here for more information on Advanced Trade Management. (http://www.ninjatrader-support.com/HelpGuideV6/PositionStrategy.html)
This is for discretionary entries and automatic exits.
If you want to fully automate your system, see here for the reference sample on reading from a file with NinjaScript:
Using StreamReader to read from a text file (http://www.ninjatrader-support.com/vb/showthread.php?t=3476)
Using System.IO File properties to write to and read from a text file (http://www.ninjatrader-support.com/vb/showthread.php?t=3477)
rpiller
09-23-2010, 05:07 PM
Cool, I'll take a look at reading a file.
Is there any other way to get external data into Ninja script? Maybe I could call a Ninja script function passing in some information from an outside source? The file thing works ok, just wondering what other options there are.
NinjaTrader_Bertrand
09-24-2010, 03:19 AM
You can take a look at what C# / MSDN offers you in this regard, some users successfully read data from a SQL database for example.
rpiller
09-24-2010, 04:14 AM
So is Ninja script C#? I know a lot of different languages so that's not an issue. I just don't know what Ninja script is.
NinjaTrader_Vincent
09-24-2010, 04:24 AM
Hi,
Yes, it is.
Please see here for more info:
http://www.ninjatrader.com/support/forum/showthread.php?t=33929
Use the arrows in the upper right corner to scroll through the documentation.
rpiller
09-24-2010, 04:27 AM
That's perfect! Thanks.
rpiller
10-01-2010, 05:53 AM
Where do I get ninja trader from? Where is the download link?
freewind
10-01-2010, 06:41 AM
In their website.
Register and they will send you an activation key via the email you registered it and then you can download the exe.
NinjaTrader_Brett
10-01-2010, 07:11 AM
Hello,
Thanks freewind!
Yep. Download link is on our website below
http://www.ninjatrader.com/webnew/download_trading_software.htm
Let me know if I can be of further assistance.