Traders Laboratory - View Single Post - Complex Order Help for TradeStation
View Single Post
  #14 (permalink)  
Old 06-05-2008, 02:43 PM
swansjr swansjr is online now
swansjr is profitable 2Q

Trader Specs
 
Join Date: Oct 2007
Location: Gurnee, IL
Posts: 21
Thanks: 5
Thanked 2 Times in 2 Posts
Re: Complex Order Help for TradeStation

I'm no expert, but your exit strategy in EasyLanguage for TS might go somethting like this:
Input:
InitalStopValue(20);

Variables:
MyStop(0),
Target1(false),
Target2(false),
Target3(false);

// Place Your Buy Condition Here

{ Entry Code }


// Exit strategy for long trades

If (MarketPosition = 1 ) Then
Begin

If ( OpenpositionProfit < 25 ) Then
MyStop = InitalStopValue;

If ( OpenPositionProfit >= 25 ) And ( Target1 = false ) Then
Begin
MyStop = EntryPrice;
Target1 = true;
End;

If ( OpenPositionProfit >= 40 ) And ( Target2 = false ) Then
Begin
MyStop = EntryPrice + 5;
Target2 = true;
End;

If ( OpenPositionProfit >= 50 ) And ( Target3 = false ) Then
Begin
MyStop = EntryPrice + 8;
Target3 = true;
End;

If ( OpenPositionProfit >= 75 ) Then
Begin
Sell("20pt Target") next bar at EntryPrice+20 limit;
MyStop = EntryPrice + 10;
End;


// Sell on MyStop

Sell("Stop") next bar at MyStop stop;

End;

// Reset target flags once position is closed

If ( MarketPosition = 0 ) Then
Begin
Target1 = false;
Target2 = false;
Target3 = false;
End;

Reply With Quote
The Following User Says Thank You to swansjr For This Useful Post:
trbates (06-05-2008)