and here if you are using Tradestation.8.1
StopLimitOrder (Function)
Disclaimer
The StopLimitOrder function is used to configure and send a limit if touched order using the order entry macro .PlaceOrder. You can call this function directly from your own EasyLanguage code to simplify the formatting and generation of macro orders.
NOTE Care should be exercised when calling this function as it is intended to send live orders. Confirmations for macro-generated orders can be configured by using the File -> Preferences -> TradeStation Order Entry menu sequence.
Syntax
StopLimitOrder(Frequency,Account,Action,SymbolCategory,Symbol,Quantity,Duration,GTDDate,StopPrice,LimitPrice)
Returns (Integer)
StopLimitOrder returns 1 if called on a "real-time" tick and if a trade is allowed based on the user input "Frequency". The function returns -1 (negative one) in other cases; for example, if the function is called on an historical bar. If there are errors in the order parameters a runtime error message will be generated and the order will not be placed.
Parameters
Name
Type
Description
Frequency
String
Sets the number of attempts made
Account
String
Sets the account to be used for this order.
Action
String
Sets the order action (buy, sell, sellshort, cover, etc.).
SymbolCategory
String
Sets the category of trading instrument represented by the symbol.
Symbol
String
Sets the symbol to be used for this order.
Quantity
Numeric
Sets the number of shares, contracts, lots, etc. to be placed for this order
Duration
String
Sets the duration of the order.
GTDDate
String
Sets the date, if appropriate, to be used with the specified duration.
StopPrice
Numeric
Sets the Stop price to be used for this order.
LimitPrice
Numeric
Sets the Limit price to be used for this order.
Remarks
The StopLimitOrder function uses the PlaceOrder function to format the order parameters and call the order entry macro. The PlaceOrder function is only intended to be used by this and other designated TradeStation functions.
This function disables advanced order placement features (All or None, Buy on minus,Sell on plus, etc.).
See .PlaceOrder command for more information on using the order entry macro for placing orders.
Example
Places a sell limit order of 100 shares for MSFT at a limit price of 24.35 using the order entry macro .PlaceOrder. Value1 returns a 1 if the order is valid.
Value1 = StopLimitOrder("Once","SIM15180","Sell","Stock","MSFT",100,"Day","",24.65,24.35);