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

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")