'오더 리밋 (9000) 을 다 썼습니다' 에러가 납니다

이 오류는 전략이 허용된 최대 주문 수보다 더 많은 주문을 넣거나 더 많은 거래를 체결했음을 의미합니다. 이러한 제한은 플랜에 따라 다르며 서버가 더 효율적으로 작동할 수 있도록 합니다.

이 에러를 막으려면 strategy() 함수에서 trim_orders 파라미터를 쓰면 됩니다. 이 파라미터를 true로 하면 새 오더마다 트레이드 리스트에 나타나고 오더 리밋을 넘어선 가장 오래된 오더가 지워집니다.

보기입니다:

//@version=5
strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100, trim_orders = true)

if bar_index % 2 == 0
    strategy.entry("My Long Entry Id", strategy.long)

if bar_index % 2 != 0
    strategy.entry("My Short Entry Id", strategy.short)
Text

아니면 주문 조건에서 타임 레인지를 확인하여 전략이 주문하는 날짜를 제한할 수 있습니다. 다음 보기 스크립트는 현재 바의 시간이 두 타임스탬프 사이에 있는지 확인하여 주문 시간 범위를 설정합니다.

//@version=5
strategy("My strategy", overlay = true, margin_long = 100, margin_short = 100)

enableFilter = input(true,"Enable Backtesting Range Filtering")
fromDate     = input.time(timestamp("20 Jul 2023 00:00 +0300"), "Start Date")
toDate       = input.time(timestamp("20 Jul 2099 00:00 +0300"), "End Date")

tradeDateIsAllowed = not enableFilter or (time >= fromDate and time <= toDate)

longCondition =  ta.crossover(ta.sma(close, 14),  ta.sma(close, 28))
shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))if longCondition and tradeDateIsAllowed
    strategy.entry("Long", strategy.long)if shortCondition and tradeDateIsAllowed
    strategy.entry("Short", strategy.short)
Java