Limit Order Entry

Posted By: BigSky

Limit Order Entry - 09/29/20 18:39

I am trying to write a simple system that enters/exits using limit orders. Its' strange that something so trivial to accomplish in Multicharts, TradeStation, Amibroker etc should be so complicated in Zorro.

I gather from the manual that an order entered using enterLong(1, limitprice) will be treated at market-if-touched orders by Zorro.

I further realize that Zorro can handle limit orders properly, assuming the broker can handle them (is there a broker that doesn't handle limit orders?). I am trading on IB.

So I need to use some kind of Trade Management Function to accomplish this simple task.

Can anyone point to an example in the documentation of code to issue a limit entry order ?

Or can anyone provide a simple example of a suitable TMF and how it should be called?

Thanks!
Posted By: danatrader

Re: Limit Order Entry - 09/29/20 19:01

https://zorro-trader.com/manual/en/buylong.htm


Example 2: Grid trading script -> sample


Entry Optional entry stop when > 0, entry limit when < 0 (overrides the global Entry).

Although, using TMF or tick function can be definitly challenging.
Posted By: BigSky

Re: Limit Order Entry - 09/29/20 19:42

Nope, doesn't work. Thats exactly what I meant when I wrote the following:

"I gather from the manual that an order entered using enterLong(1, limitprice) will be treated at market-if-touched orders by Zorro."

Assuming limitprice < 0 , Zorro treats this as a limit order, at least in theory. Except it doesn't. In fact it treats it as a market-if-touched order. Completely different (slippage).

So you have to use a TMF to get a proper limit order executed. The question is how? I cant find a single, clean example in the documentation.
Posted By: Zheka

Re: Limit Order Entry - 09/30/20 15:52

What you need is the "OrderLimit" - which will send a real limit order to IB. Search the manual for "OrderLimit" and then EntryTime/ OrderDelay/SET_ORDERTYPE.

Also, study the "IB Plugin" page and SET_ORDERTEXT which allows to use most order types (adaptive, etc) available via IB.
© 2024 lite-C Forums