Tradestation OOEL (Object Oriented EasyLanguage)
(Professional Software Solutions)
  

tsdata.common Contains classes that are used by other tsdata namespaces.
tsdata.marketdata Contains classes that are used to access market data such as price quotes, market levels, and fundamental values.
tsdata.trading Contains classes that are used to manage trades, positions, and account information.
PositionProvider 
elsystem Contains base classes that are used by tsdata classes and other elsystem classes.
elsystem.collections Contains base classes that are used to create different types of collection objects.
elsystem.elcomponentmodel Contains base classes that are used to describe the editing behavior of components.
elsystem.windows.forms Contains classes that are used to create forms controls and containers.
elsystem.io Contains base classes that are used to handle input/output system exceptions.
elsystem.excel Contains base classes that are used to access data from Excel spreadsheet files.
elsystem.xml Contains base classes that are used to manage data in XML files.
easylanguage Contains references to legacy EasyLanguage reserved words and functions.
strategy Contains classes that are used to manage strategies and strategy automation.


OOEL Samples 
Using tsdata.trading ; // namespace ( library ) to fetch order related classes 
Using tsdata.common ; 

Inputs: 
String MySymbol( Symbol ), // default of chart symbol 
Int MySymbolCategory( Category ), // default of chart symbol type 
String MyAccount( Getaccountid ), // default account for chart symbol 
Double OnePriceTick( Minmove / Pricescale ), // default min price movement for chart symbol 
Int NumShares( 100 ), 
Int LongOrShortEntry( 1 ), // default long: > 0 = Long < 0 = Short 
Int ProfitTgtTicks( 10 ), // default of 10 ticks beyond entry 
Int StopTrailTicks( 20 ) ; // default of 20 ticks beyond entry 

variables: 

// Declare Order Tickets and Order Objects 
OrderTicket EntryOrdTkt( NULL ), 
OrderTicket ExitTrailStpOrdTkt( NULL ), 
OrderTicket ExitProfitTgtOrdTkt( NULL ), 

OSOOrderTicket OSOOrdTkt( NULL ), 
OCOOrderTicket OCOOrdTkt( NULL ), 

Order MyOSOOrder( Null ) ; 

// Only one time at indicator startup do we need to create the 
// OrderTicket Objects and then set their Properties 
Once begin 

//--------------------------- 
// Error check Inputs 
//--------------------------- 
If LongOrShortEntry = 0 then 
RaiseRunTimeError(" LongOrShortEntry cannot equal zero(0)" ) ; 

If NumShares <= 0 then 
RaiseRunTimeError(" NumShares must be greater than zero(0)" ) ; 

If MySymbol = "" then 
RaiseRunTimeError(" MySymbol cannot be blank" ) ; 

If MyAccount = "" then 
RaiseRunTimeError(" MyAccount cannot be blank" ) ; 

If ProfitTgtTicks <= 0 then 
RaiseRunTimeError(" ProfitTgtTicks must be greater than zero(0)" ) ; 

If StopTrailTicks <= 0 then 
RaiseRunTimeError(" StopTrailTicks must be greater than zero(0)" ) ; 


//---------------------------------------------- 
// Instantiate( Create ) Order Ticket Objects 
//---------------------------------------------- 
EntryOrdTkt = new OrderTicket ; 
ExitTrailStpOrdTkt = new OrderTicket ; 
ExitProfitTgtOrdTkt = new OrderTicket ; 
OSOOrdTkt = new OSOOrderTicket ; 
OCOOrdTkt = new OCOOrderTicket ; 


//------------------------------------------------------ 
// Set OSO Entry Order Ticket Properties( parameters ) 
//------------------------------------------------------ 
EntryOrdTkt.Symbol = MySymbol ; 
EntryOrdTkt.SymbolType = MySymbolCategory ; 
EntryOrdTkt.Account = MyAccount ; 
EntryOrdTkt.Quantity = NumShares ; 
EntryOrdTkt.Type = OrderType.market ; 
EntryOrdTkt.Duration = "Day" ; 

// Set order type ( buy or sellshort ) based on input 
If LongOrShortEntry > 0 then 
EntryOrdTkt.Action = OrderAction.buy 
Else 
EntryOrdTkt.Action = OrderAction.sellshort ; 


//------------------------------------------------------------------- 
// Set OCO Exit Trailing Stop Order Ticket Properties( parameters ) 
//------------------------------------------------------------------- 
ExitTrailStpOrdTkt.Symbol = MySymbol ; 
ExitTrailStpOrdTkt.SymbolType = MySymbolCategory ; 
ExitTrailStpOrdTkt.Account = MyAccount ; 
ExitTrailStpOrdTkt.Quantity = NumShares ; 
ExitTrailStpOrdTkt.Type = OrderType.stopmarket ; 
ExitTrailStpOrdTkt.Duration = "Day" ; 

// Set order exit type ( sell or buytocover ) based on entry type 
If LongOrShortEntry > 0 then 
ExitTrailStpOrdTkt.Action = OrderAction.sell 
Else 
ExitTrailStpOrdTkt.Action = OrderAction.buytocover ; 

// Set trailing stop parameters 
ExitTrailStpOrdTkt.TrailingStop = TrailingStopBehavior.points ; 
ExitTrailStpOrdTkt.TrailingStopAmount = StopTrailTicks * OnePriceTick ; 


//-------------------------------------------------------------------- 
// Set OCO Exit Profit Target Order Ticket Properties( parameters ) 
//-------------------------------------------------------------------- 
ExitProfitTgtOrdTkt.Symbol = MySymbol ; 
ExitProfitTgtOrdTkt.SymbolType = MySymbolCategory ; 
ExitProfitTgtOrdTkt.Account = MyAccount ; 
ExitProfitTgtOrdTkt.Quantity = NumShares ; 
ExitProfitTgtOrdTkt.Duration = "Day" ; 
ExitProfitTgtOrdTkt.Type = OrderType.limit ; 

// Set limit order parameters to be so many ticks from 
// the entry using parentplus style 
ExitProfitTgtOrdTkt.LimitPriceStyle = PriceStyle.parentplus ; 

// Set order exit type ( sell or buytocover ) based on entry type 
If LongOrShortEntry > 0 then begin 
ExitProfitTgtOrdTkt.Action = OrderAction.sell ; 
ExitProfitTgtOrdTkt.LimitPriceOffset = ProfitTgtTicks ; 
End 
Else Begin 
ExitProfitTgtOrdTkt.Action = OrderAction.buytocover ; 
ExitProfitTgtOrdTkt.LimitPriceOffset = -ProfitTgtTicks ; // set negative ticks to properly 
End ; // place profit tgt exit above short 



//------------------------------------------------------------------- 
// 
// Define OCO Order ticket: Add the Stop Trail and Profit Tgt tickets 
// 
// This is similar to an OCO Exit Bracket where if any leg fills 
// all other legs of the OCO are immediately cancelled. This 
// type of order ticket allows you to add more than 2 order legs 
// while a standard OCO Bracket is limited to only 2 legs. 
// 
//------------------------------------------------------------------- 
OCOOrdTkt.Siblings.Add( ExitTrailStpOrdTkt ) ; 
OCOOrdTkt.Siblings.Add( ExitProfitTgtOrdTkt ) ; 


//--------------------------------------------------------------- 
// 
// Define OSOOrder ticket: Add Entry order and Orders to Send 
// when Entry Order fills. The Orders to Send are the OCO 
// order ticket, which itself contains multiple tickets. 
// You could add additional order tickets to issue when the 
// Entry Order fills - you are not limited to just one ticket. 
//--------------------------------------------------------------- 
OSOOrdTkt.PrimaryTicket = EntryOrdTkt; 
OSOOrdTkt.SecondaryTickets.Add( OCOOrdTkt ) ; 

End ; 

// Issue order ticket only 1 time on first real-time tick 
If LastBarOnChart then begin 

// Use Send Method to issue any OrderTicket. The OrderTicket 
// returns the Order Object which is created when the ticket 
// is processed. The Order Object represents the Order which 
// is placed on the Order Server. So we assign an Order Object 
// to the OrderTicket when we Send it. 
Once MyOSOOrder = OSOOrdTkt.Send() ; 

End ;