B003
more than one strategy declaration
Severity Error
A script can be a strategy only once: it has one broker emulator, one equity curve and one set of properties. A second strategy declaration was found.
Merge both into a single grouped declaration: strategy ( ... ) with one property per line.
Failing example
script "Funding fade"
strategy initialCapital = 25_000.0
strategy leverage = 2.0
data (
chart = subscribe(data.ohlcv)
funding = subscribe(data.funding)
)
on chart.close {
let r = funding.rate ?? 0.0
if r > 0.0005 && strategy.position.size == 0.0 {
strategy.entry("Fade", direction.short)
}
if r < 0.0001 {
strategy.close("Fade")
}
}Fixed example
script "Funding fade"
strategy (
initialCapital = 25_000.0
leverage = 2.0
)
data (
chart = subscribe(data.ohlcv)
funding = subscribe(data.funding)
)
on chart.close {
let r = funding.rate ?? 0.0
if r > 0.0005 && strategy.position.size == 0.0 {
strategy.entry("Fade", direction.short)
}
if r < 0.0001 {
strategy.close("Fade")
}
}