Gerenciamento de Risco

//@version=4
strategy("multi risk demo", overlay=true, pyramiding=10, calc_on_order_fills = true)
if year > 2014
    strategy.entry("LE", strategy.long)
strategy.risk.max_intraday_filled_orders(5)
strategy.risk.max_intraday_filled_orders(2)
//@version=4
strategy("allow_entry_in demo", overlay=true)
if year > 2014
    strategy.entry("LE", strategy.long, when=strategy.position_size <= 0)
    strategy.entry("SE", strategy.short, when=strategy.position_size > 0)
strategy.risk.allow_entry_in(strategy.direction.long)