[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TS timing and handling of orders



PureBytes Links

Trading Reference Links

Here's several questions regarding trade orders created by TS. They dig into 
the nitty-gritty timing of who automatically gets what when.

Suppose I have 20 buy-stop orders, with almost random stop values ..... 

buy ("entry+1") next bar at $5.00 stop;
buy ("entry+2") next bar at $4.40 stop;
buy ("entry+3") next bar at $4.10 stop;
buy ("entry+4") next bar at $5.60 stop;
...
buy ("entry+20") next bar at $4.80 stop;

Assuming the price is now $3.50, what is the most efficient way to determine
which of these entries have been filled, and which are yet unfilled.

Now suppose down the road the price is at $5.00, some of the buy-stop orders
are still not yet filled and I decide to place a single short-stop order:

sellShort ("entry-1") next bar at $4.80 stop;

When does TS automatically notify the broker to exit the long entries that
were filled? before or after the short order is filled?

Would TS attempt to cancel any unfilled buy orders still out there?  
Would TS attempt to determine if all the longs had in fact exited?

When do order requests actually get sent to the broker? On every bar until
filled? Or does TS withhold the order until it sees the price has hit the 
stop value and *then* sends out the order to the broker?

What if TS thinks the order was filled (because price has crossed the stop 
value) but for some reason it really wasn't ?  How can  EL code be written 
to verify what it thinks is going on is actually correct? And if this code 
discovers that an order was not filled, how can additional code be written 
to force TS to change it's thinking about an order's status?

Lastly, the TS4 user manual suggests that to place a buy stop-limit order 
(whereby the trade occurs only between two specified prices), you need to 
use a combination of buy commands, since there is no explicit stop-limit 
command in EL.  To simplify, suppose I want to buy at one specific price 
only, the code would look like this...

if open of next bar >= MyPrice
     then buy next bar at MyPrice limit 
     else buy next bar at MyPrice stop;

This works with backtesting since the next bar's open can be obtained now 
(by just looking at it). However, when trading live, that information is not 
available yet until the next bar opens.  Does this imply that during real 
time trading, the execution of the above code is delayed until the next 
bar's open? If so, does that force all the code in the same strategy to also 
be delayed?

Sorry if all this seems so microscopic. 
Sometimes the devil is in the details.


Regards,

Mark Jurik