Skip to content
Algo Trade Analytics Docs

strategy.risk.max_cons_loss_days() - Pine Script Function

The purpose of this rule is to cancel all pending orders, close all open positions and stop placing orders after a specified number of consecutive days with losses. The rule affects the whole strategy.

strategy.risk.max_cons_loss_days(count, alert_message) → void
NameTypeDescription
countsimple intA required parameter. The allowed number of consecutive days with losses.
//@version=6
strategy("risk.max_cons_loss_days Demo 1")
strategy.risk.max_cons_loss_days(3) // No orders will be placed after 3 days,
if each day is with loss.
plot(strategy.position_size)