Skip to content
Algo Trade Analytics Docs

strategy.risk.allow_entry_in() - Pine Script Function

This function can be used to specify in which market direction the strategy.entry function is allowed to open positions.

strategy.risk.allow_entry_in(value) → void
NameTypeDescription
valuesimple stringThe allowed direction. Possible values: strategy.direction.all
strategy.direction.long
strategy.direction.short
//@version=6
strategy("strategy.risk.allow_entry_in")
strategy.risk.allow_entry_in(strategy.direction.long)
if open > close
strategy.entry("Long", strategy.long)// Instead of opening a short position with 10 contracts, this command will close long entries.
if open < close
strategy.entry("Short", strategy.short, qty = 10)