strategy.entry
Enters a position: buys (strategy.long) or sells (strategy.short) qty contracts (default from strategy()). An open position the other way is reversed, so the order is its size plus qty. In the same direction at most pyramiding entries are held. With limit or stop it waits at that price; with both it is a stop-limit order (when the stop trades it becomes a limit order at limit, working from the next bar unless the stop gapped at the open); a new call with the same id replaces the waiting order. A qty under one contract (0 when a size by risk comes out too small) places no order and counts as a size skip in the report. Given on a bar, it fills from the next bar. Orders with the same oca_name form a one-cancels-all group (a buy stop above and a sell stop below a range).
strategy.entry(id: string, direction: string, qty: float = na, limit: float = na, stop: float = na, comment: string = na, oca_name: string = na, oca_type: string = na)
Parameters
idstring: the order name; trades and the chart show itdirectionstring: strategy.long or strategy.shortqtyfloat: Contracts to buy or sell (default: the size set in strategy()).limitfloat: A limit price: the order waits at it (default na, a market order).stopfloat: A stop price: the order waits at it; with limit too it is a stop-limit order (default na).commentstring: Text kept with the order; the trade it closes keeps the closing order's comment (default none).oca_namestring: one-cancels-all group: the first order of the group to fill cancels the othersoca_typestring: strategy.oca.cancel (the default with oca_name) or strategy.oca.none
Example
if ta.crossover(fast, slow)
strategy.entry("Long", strategy.long)
strategy.entry("Up", strategy.long, stop=rangeHigh, oca_name="range")
strategy.entry("Down", strategy.short, stop=rangeLow, oca_name="range")