Documentation

 

 

 

 

Available Topics:

Things to know
Settings
Symbol Manager
Quote & Positions

Order Parameters
Strategy Manager
Message Window
Order Entry
Order Management
Manual Scaling
Trail Management
Chase
Simulated Entry & Stops
Statistics Manager
Automated Trading
Miscellaneous

SuperDOM



 

Application Specific Information:

Investor RT Tutorial
NeoTicker
Amibroker
TradeStation
 

 

 


 

 

 

Automated Trading

Listen to an audio presentation here.

Automated Trading allows you to integrate NinjaTrader with various charting applications in order to automate your trading systems. This means that you are able to turn generated trading signals into sets of order instructions that will be processed and passed through NinjaTrader to Interactive Brokers TWS. You will find charting application specific help and tutorials on the links to your left.

NT supports passive integration through "Order Instruction Files" (OIF) read from the NinjaTrader application install directory. By checking the "AT" checkbox in the upper right hand corner of the main NT window, NT will be instructed to check the above directory at user specified intervals set in the  'SETTINGS' manager for new OIFs. NT offers Direct Automation  and Passthrough Automation. Most charting applications have the ability to export user defined text files based on trading signals generated within the charting application. NT reads the instructions from these text files and automatically passes the order information to TWS.

Direction Automation

Direct Automation is where the order  processed is managed within NT once filled. All NT order parameters are supported in this mode. You can only process and manage one open position at a time in this mode. NT MUST contain the symbol in the symbol manager for the order that is being placed. The symbol DOES NOT need to be the active SYMBOL #1. If NT currently is managing an open position, any new order placement information will be ignored. NT is an optional multi-step automated system. Once the initial order is processed and submitted to TWS, you can modify or cancel the order manually, or through automation using Cancel or AdjustEntry OIF's all before its filled. Once an order is filled, you can manage the position manually through NT, or through automation using STOP order Adjustments OIF's and Close Position OIF's. You can have NT notify you for each new order being processed and provide you with an option to process the order or ignore it. This option is set under "SETTINGS".

There are several different OIF's that NT can process. They are Entry OIF, Cancel OIF, AdjustEntry OIF, STOP/TARGET Adjustment OIF, Close OIF and Reverse OIF.  NT returns information through several files. Upon initial entry and final exit, NT passed transaction information back through Entry and Exit Update Files. The position.txt file returns the state of NT.

 

Entry OIF

The Entry OIF must be placed in the NinjaTrader application install directory, named entry.txt and must be in the following format on a single line:

The parameters MUST be in the following order, and in CAPS.

"SYMBOL","ACTION","CONTRACTS/SHARE QTY","CONTRACTS SHARE QTY2","EXIT TYPE","ORDER TYPE","LIMIT PRICE","STOP PRICE","TARGET 1 OFFSET","TARGET 2 OFFSET","STOP OFFSET","BREAKEVEN TRIGGER OFFSET","BREAKEVEN PLUS","LIMIT PRICE 2","STOP PRICE 2",

Where:

Symbol : Instrument symbol (this must already exist in the NT symbol manager)
Action : Valid values are "BUY" or "SELL"
Contracts/Share qty : Any integer value
Contracts/Share qty 2 : Value used for the AutoScale exit type. Can NOT leave this parameter blank, at minimum the value must be "0".
Exit Type : Valid values are "MANUAL", "BRACKET"or "SCALE"
Order type : Valid values are "MKT","LMT", "STP" or "STP LMT"
Limit Price : Must contain a minimum value of "0"
Stop Price : This is the STOP value for the entry order. Must contain a minimum value of "0"
Target 1 Offset : Must contain a minimum value of "0"
Target 2 Offset : Must contain a minimum value of "0"
Stop Offset : Must contain a minimum value of "0"
Breakeven Trigger Offset : Must contain a minimum value of "0"
Breakeven Plus: Valid values are "TRUE" or "FALSE"
Limit Price 2 - Must contain a minimum value of "0"
Stop Price 2 - Must contain a minimum value of "0"

"Limit and Stop Price 2" parameters are used when send an OCA entry pair to NinjaTrader. They will represent the lower priced order where "Limit and Stop Price" parameters will represent the higher priced order. If sending an OCA entry pair, the "Action" parameter must be left blank.

Each new OIF can not be an appended file. It must be a new file, with a single line instruction set. NT will monitor the install directory for this file. Whenever a new file is deposited, NT will process the instructions (provided that there is no current open position) and pass an order to TWS. A short whistle sound will play each time an OIF file is processed and an order is submitted. NT will cease monitoring for entry.txt until either the entry order is cancelled or a filled position is closed. If the order is pending (not yet filled), NT monitors for a cancel.txt and a adjustentry.txt OIF.  Upon a successful fill, NT will cease monitoring for these files. NT will now begin to monitor for a close.txt, reverse.txt and a adjuststoptarget.txt OIF.  See example.

 

Cancel  OIF

The Cancel OIF must be placed in the Ninjatrader application install directory , be named cancel.txt and must be in the following format:

"SYMBOL","CANCEL",

NT will monitor the above directory for this file only after an order is placed through automation. NT will cancel the pending order if the symbol matches the pending order symbol. NT will then cease monitoring for Cancel and AdjustEntry OIF's and resume monitoring for ENTRY OIF's.

 

AdjustEntry OIF

The AdjustEntry OIF must be placed in the Ninjatrader application install directory, be named adjustentry.txt and must be in the following format:

"SYMBOL","UPPER LIMIT /DEFAULT LIMIT","UPPER STOP/DEFAULT STOP","LOWER LIMIT","LOWER STOP",

NT will monitor the above directory for this file only after an order is placed through automation. NT will adjust the current entry price to the value(s) specified only if the symbol matches the current orders symbol.

 

STOP/TARGET Adjustment OIF

The STOP Order Adjustment OIF must be placed in the Ninjatrader application install directory , be named adjuststoptarget.txt and must be in the following format:

"SYMBOL","STOP PRICE","TARGET PRICE",

NT will monitor the above directory for this file only after an order is filled through automation. NT will adjust the current positions STOP LOSS order to the value specified only if the symbol matches the current position's symbol. Price parameters must have a minimum value of zero.

 

Close OIF

The CLOSE Position OIF must be placed in the c:\ninjatrader directory or the directory in which you installed NinjaTrader, and be named close.txt and must be in the following format:

"SYMBOL","CLOSE",

NT will monitor the above directory for this file only after an order is filled through automation. NT will close the current position if the symbol matches the open position. From this point, NT will cease monitoring for STOP Order Adjustment and CLOSE Position OIF's and resume monitoring for ENTRY OIF's.

 

Reverse OIF

Reverse OIF.  This command will close and reverse your current position. Order parameters are based on the parameters displayed in the order parameters section at the time the file is processed. The file must be submitted to the NinjaTrader installation directory and named reverse.txt and is in the following format:

"SYMBOL","REVERSE",

 

Entry and Exit Update Files

These files are generated upon initial fill and upon final exit. The files are located in the NinjaTrader installation directory and named automatedentryupdate.txt and automatedexitupdate.txt and are in the following format:

"SYMBOL","ACTION","PRICE","QTY","DATE/TIME",

 

Position Update File

This file is updated at different stages within the order processing flow.  The file is located in the NinjaTrader installation directory and named position.txt and is in the following format:

"STATE",

Possible values are: LONG, SHORT, PENDING or FLAT

 

EXAMPLE:

"NQ","BUY,"2","0","BRACKET","MKT","0","0","8","0","3","3","FALSE","0",0",

This ENTRY OIF will place an order for 2 NQ contracts LONG at Market. Once filled, NT will issue a pair of OCA orders, the 1st is a LIMIT order +8 pts from the entry fill with a -3pt STOP order. Once +3 PTS of profit is reached on the BID, NT will raise the STOP order to "breakeven" which is the entry fill price.

"ES","SELL,"2","1","SCALE","LMT","980","0","2","4","2","0","FALSE","0","0",

This ENTRY OIF will place an order for 2 ES contracts SHORT at a LIMIT of 980. Once filled, a 1st OCA group will be submitted with a 1st target LIMIT order of +2 pts from the entry fill and a -2pt STOP order for the entire position. Once the 1st target is filled, a second OCA group will be issues for the remain 1 contract with a target of +4 pts from the entry fill price.

 

 

     

Passthrough Automation

Passthrough automation is where NT processes the OIF's and passes orders directly to TWS with an accompanying set of OCA STOP and PROFIT orders. NT does NOT manage the order once it is filled. This mode is optional (set in "SETTINGS") and runs in parallel to Direct Automation mode. If NT is managing an open position, Passthrough automation will still be active and place orders. It is important to know, when Passthrough Automation is processing a valid OIF for order placement, NT will delete this file once the entire order entry and OCA STOP and PROFIT order submission is complete. Its also important to note that symbols specified in OIF's for PassThrough processing does NOT need to be contained in NT's symbol manager.

 

PassEntry OIF

The PassEntry OIF must be placed in the Ninjatrader application install directory , named passentry.txt and be in the following format on a single line:

"ACTION","CONTRACTS/SHARE QTY","SYMBOL","SECTYPE","EXPIRY","EXCHANGE","ENTRY ORDERTYPE","LIMIT PRICE","STOP PRICE","TARGET OFFSET","STOP OFFSET","INCREMENT","EXIT ORDER TYPE","STOP LIMIT OFFSET","TIME IN FORCE",

Where:

Action : Valid values are "BUY" or "SELL"
Contracts/Share qty : Any integer value
Symbol : Any valid IB symbol
SecType : Security type, valid values are "FUT" or "STK"
Expiry : Expiration date in the format "200306"
Exchange : Valid values can include "GLOBEX" , "ACE" and "SMART"
Entry Order Type : Valid values are "LMT", MKT" ,"STP" and "STP LMT"
Limit Price : Must contain a minimum value of "0"
Stop Price : Must contain a minimum value of "0"
Target Offset : Must contain a minimum value of "0"
Stop Offset : Must contain a minimum value of "0"
Increment : Usually tick size. For NQ's value would be "0.50", for stocks, could be "0.01"
Exit Order Type : Valid values are "STP" or "STP LMT"
Stop Limit Offset : Must contain a minimum value of "0"
Time in Force : Must contain a value of either "DAY", "GTC" or "IOC"

NT monitors for this file at the same specified interval as the other OIF's although there is a programmed offset to stagger the monitoring 1/10 of a second behind the Direct Automation file monitoring intervals. This is to avoid possible OIF's crashing NT at the exact same moment.

Passthrough automation is powerful if you have multiple trade signals generated within close proximity. NT will allow you to sit back while all of your trade signals are converted to real-time open positions with protective STOP LOSS and PROFIT orders.