Support

Equilla Formula Language

Cover

This is an exit signal. It places an order to go close a short position or reduce it by a number of shares using a given trade mode.

Syntax

Cover [("Name")] [From Entry ("EntryName")] [Quantity Shares|Contracts [Total]] [TradeMode] [Trading Symbol]

Inputs

Name
: (Optional) Specifies the name of this order. Can be any valid constant string. String variables are not allowed here. Please note that the brackets are mandatory here. Naming orders is especially useful when using pyramiding.
EntryName
: (Optional) Specifies the name of the order that this closing order refers to. Any valid constant string. String variables are not allowed here. Please note that the brackets are mandatory here.
Quantity
: (Optional) The quantity of shares/contracts that will be traded. If omitted the complete position is closed. If quantity is used then the current position is reduced by the number of shares specified in amount.
Total
: (Optional) If the Total keyword is used, the complete position is reduced by the number of shares specified in amount. If total is not used then each order in the current position is reduced by the number of shares specified in amount. Example: A system goes short with 2 shares and another 2 shares in a second order. Pyramiding is enabled. A "cover 1 share" would reduce each order by one so you are still 2 shares short (1+1). A "cover 1 share total" order would reduce only one order (the first one) by one share, so you are 3 shares short (1+2).
TradeMode
: (Optional) The trademode controls how the actual trade is being processed. There are several modes available. The table below describes the different trademodes in more detail. If the trade mode is omitted, "Next Bar at Market" is taken as the default.
Symbol
: (Optional) The symbol the order should be generated for. The default value is Data1.

Remarks

Trade Modes

Mode Description
This Bar at Market The trade is executed immediately.
This Bar on Close The trade is executed when the current bar closes.
Next Bar at Market The trade is executed at the next bar's opening price.
Next Bar at price Stop Places a stop order. If the price is equal or higher than price on the next bar, the order is executed. Otherwise it gets cancelled. This order is only valid on the next bar
Next Bar at price Limit Places a limit order. If the price is equal or lower than price on the next bar, the order is executed. Otherwise it gets cancelled. This order is only valid on the next bar
This Bar at price The trade is executed at the specified price. The order is executed regardless of the current price, however the price will be adjusted to fit into the current bar's high/low price range. If the order can not be filled immediately it will get cancelled. WARNING: This order type is entirely artificial and, if used for realtime trade generation, will lead to results that do not mimic real trades. This order type is best used to produce orders during backtesting that are synchronised with actual, previously executed orders.

Examples

Drecrease every open short entry by five shares
Cover 5 Shares Next Bar at Market;
Decrease the current open short position by one share
Cover 1 Share Total Next Bar at Market;
Close all open short entries named "entry1"
Cover ("exit1") from entry ("entry1") This Bar on Close;
Close an open short position if the price is higher than or equal to the current bars high price
Cover Next Bar at High Limit;
Close an open short position if the price is less than or equal to the current bars low price
Cover Next Bar at Low Stop;
Close any existing short position
Cover Next Bar at Market;
Generate a cover order based on the next bars open price
Cover 2 Shares Next Bar at Open of Next Bar - 3 Limit;
A simple trading system
Input: Price( Close ), Period( 10, 1 ); If Average( Price, Period ) Crosses Price Then Cover Next Bar at Market Else If Price Crosses Average( Price, Period ) Then Short Next Bar at Market;
Trade Data2 depending on its price compared to the price of Data1
If Close of Data2 <; Close of Data1 Then Short Next Bar At Market Trading Data2 Else Cover Next Bar At Market Trading Data2;