Buy and Sell#

PowerLanguage provides Buy, Sell, SellShort and BuyToCover order instructions. The syntax of order instructions is composed of Action + Entry/Exit Name and TradeSize + OrderCommandType.

ActionEntry/Exit Name and TradeSizeOrderCommandType
Buy[("EntryLabel")] [TradeSize]OrderCommandType
Sell[("ExitLabel")] [From Entry("EntryLabel")] [TradeSize [Total]]OrderCommandType
SellShort[("EntryLabel")] [TradeSize]OrderCommandType
BuyToCover[("ExitLabel")] [From Entry("EntryLabel")] [TradeSize [Total]]OrderCommandType

OrderCommandType#

OrderCommandType determines the timing and price of placing an order. There are 4 types:

OrderCommandTypeDescription
This Bar On CloseSends a market order on the last tick of the current bar. The chart arrow is displayed at the current bar’s closing price. On is a skip word
Next Bar At MarketSends a market order on the first tick of the next bar. The chart arrow is displayed at the next bar’s opening price. Market and Open are interchangeable, i.e., Next Bar At Open. At is a skip word
Next Bar At <Price> LimitSends a limit order at price <Price> on the next bar. If the order is not filled by the end of the bar, it is cancelled. The chart arrow is displayed at the fill price that satisfies the limit condition. At is a skip word
Next Bar At <Price> StopSends a stop order at price <Price> on the next bar. If the order is not filled by the end of the bar, it is cancelled. The chart arrow is displayed at the fill price that satisfies the stop condition. At is a skip word

In practice, it is not recommended to use This Bar On Close, as it may cause inconsistencies between live trading and backtesting signals. In live market data, MultiCharts needs to receive the first tick of the next bar to determine that the previous bar has completed; whereas in backtesting, historical data allows the last tick of the bar to be known in advance without waiting for the next bar. See Completed Bars.

Buy Instruction#

Buy instruction places a buy order. If there is a short position when the buy order is filled, the short position will be closed.

Syntax#

1
Buy [("EntryLabel")] [TradeSize] OrderCommandType;
Syntax ElementDescription
EntryLabelNames the entry, displayed on the chart. Can be omitted; default names are "Buy", "Buy#2", "Buy#3" in order. When selling (Sell), this name can be used to specify which entry to sell
TradeSizeNumber of shares (contracts) to buy, followed by Share/Shares/Contract/Contracts. Can be omitted; defaults to the value in Settings -> Strategy Properties -> Properties -> Fixed Order Shares (Contracts)
OrderCommandTypeSpecifies the order type, timing, and price. See OrderCommandType

Example#

On the next bar, place a market order to buy 1 contract, naming the entry "Entry".

1
Buy("Entry") 1 Contract Next Bar Market;

On the next bar, place a limit order at 100 to buy 2 shares.

1
Buy 2 Shares Next Bar At 100 Limit;

On the next bar, place a stop order at 50 to buy 10 contracts.

1
Buy 10 Contracts Next Bar 50 Stop;

Sell Instruction#

Sell instruction sells long positions.

Syntax#

1
Sell [("ExitLabel")] [From Entry("EntryLabel")] [TradeSize [Total]] OrderCommandType;
Syntax ElementDescription
ExitLabelNames the exit, displayed on the chart. Can be omitted; default names are "Sell", "Sell#2", "Sell#3" in order
EntryLabelSpecifies the entry name to sell from. From is a skip word and can be omitted. Can be omitted; defaults to all entry positions
TradeSizeSpecifies the number of shares (contracts) to sell from each long entry position, followed by Share/Shares/Contract/Contracts. If followed by Total, sells on a First In, First Out (FIFO) basis, selling from the earliest entries first, for a total of TradeSize shares (contracts). Can be omitted; defaults to selling all shares (contracts)
OrderCommandTypeSpecifies the order type, timing, and price. See OrderCommandType

Example#

On the next bar, place a market order to sell 10 shares from the entry named "Original Entry".

1
Sell Entry("Original Entry") 10 Shares Next Bar At Market;

On the next bar, place a market order to sell 5 contracts from each entry position.

1
Sell 5 Contracts Next Bar Market;

On the next bar, place a limit order at 100 to sell a total of 1 share from all entry positions.

1
Sell 1 Share Total Next Bar At 100 Limit;

On the next bar, place a stop order at 50 to sell all shares (contracts), equivalent to closing all positions.

1
Sell Next Bar 50 Stop;

SellShort Instruction#

SellShort instruction places a short sell order. If there is a long position when the short sell order is filled, the long position will be closed.

SellShort can also be written as Sell Short (with a space in between).

Syntax#

1
SellShort [("EntryLabel")] [TradeSize] OrderCommandType;
Syntax ElementDescription
EntryLabelNames the entry, displayed on the chart. Can be omitted; default names are "Short", "Short#2", "Short#3" in order. When covering (BuyToCover), this name can be used to specify which entry to cover
TradeSizeNumber of shares (contracts) to short sell, followed by Share/Shares/Contract/Contracts. Can be omitted; defaults to the value in Settings -> Strategy Properties -> Properties -> Fixed Order Shares (Contracts)
OrderCommandTypeSpecifies the order type, timing, and price. See OrderCommandType

Example#

On the next bar, place a market order to short sell 1 contract, naming the entry "Entry".

1
SellShort("Entry") 1 Contract Next Bar Market;

On the next bar, place a limit order at 100 to short sell 2 shares.

1
SellShort 2 Shares Next Bar At 100 Limit;

On the next bar, place a stop order at 50 to short sell 10 contracts.

1
SellShort 10 Contracts Next Bar 50 Stop;

BuyToCover Instruction#

BuyToCover instruction buys to cover short positions.

BuyToCover can also be written as Buy To Cover (with spaces in between).

Syntax#

1
BuyToCover [("ExitLabel")] [From Entry("EntryLabel")] [TradeSize [Total]] OrderCommandType;
Syntax ElementDescription
ExitLabelNames the exit, displayed on the chart. Can be omitted; default names are "Cover", "Cover#2", "Cover#3" in order
EntryLabelSpecifies the short entry name to cover. From is a skip word and can be omitted. Can be omitted; defaults to all entry positions
TradeSizeSpecifies the number of shares (contracts) to cover from each short entry position, followed by Share/Shares/Contract/Contracts. If followed by Total, covers on a First In, First Out (FIFO) basis, covering the earliest short entries first, for a total of TradeSize shares (contracts). Can be omitted; defaults to covering all shares (contracts)
OrderCommandTypeSpecifies the order type, timing, and price. See OrderCommandType

Example#

On the next bar, place a market order to cover 10 shares from the entry named "Original Entry".

1
BuyToCover Entry("Original Entry") 10 Shares Next Bar At Market;

On the next bar, place a market order to cover 5 contracts from each entry position.

1
BuyToCover 5 Contracts Next Bar Market;

On the next bar, place a limit order at 100 to cover a total of 1 share from all entry positions.

1
BuyToCover 1 Share Total Next Bar At 100 Limit;

On the next bar, place a stop order at 50 to cover all shares (contracts), equivalent to closing all positions.

1
BuyToCover Next Bar 50 Stop;

Reference#

https://www.multicharts.com/trading-software/index.php?title=Category:Strategy_Orders

https://www.multicharts.com/trading-software/index.php?title=Buy

https://www.multicharts.com/trading-software/index.php?title=Sell

https://www.multicharts.com/trading-software/index.php?title=SellShort

https://www.multicharts.com/trading-software/index.php?title=BuyToCover

© 2026 CodeReindeer. All rights reserved.