Add AI generated cap-band strategy example
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
let refresh_rate = 15;
|
||||
let stocknum = 40;
|
||||
let xs = 0.008;
|
||||
let base_index_level = 2000;
|
||||
let lower_offset = 3;
|
||||
let upper_offset = 28;
|
||||
|
||||
fn cap_floor(current_price, base_index_level, xs, lower_offset) {
|
||||
round((current_price - base_index_level) * xs + lower_offset)
|
||||
}
|
||||
|
||||
fn cap_ceiling(current_price, base_index_level, xs, upper_offset) {
|
||||
round((current_price - base_index_level) * xs + upper_offset)
|
||||
}
|
||||
|
||||
strategy("ai_generated_000001_open_cap_band") {
|
||||
market("CN_A")
|
||||
benchmark("000852.SH")
|
||||
signal("000001.SH")
|
||||
|
||||
rebalance.every_days(refresh_rate).at("10:18")
|
||||
|
||||
universe.exclude("paused", "st", "kcb", "one_yuan", "new_listing")
|
||||
|
||||
selection.limit(stocknum)
|
||||
selection.market_cap_band(
|
||||
field="market_cap",
|
||||
lower=cap_floor(signal_open, base_index_level, xs, lower_offset),
|
||||
upper=cap_ceiling(signal_open, base_index_level, xs, upper_offset)
|
||||
)
|
||||
|
||||
filter.stock_expr(
|
||||
stock_ma5 > stock_ma10 &&
|
||||
stock_ma10 > stock_ma30 &&
|
||||
rolling_mean("volume", 5) < rolling_mean("volume", 60) &&
|
||||
!ends_with(symbol, ".BJ") &&
|
||||
!at_upper_limit &&
|
||||
!at_lower_limit
|
||||
)
|
||||
|
||||
ordering.rank_by("market_cap", "asc")
|
||||
}
|
||||
Reference in New Issue
Block a user