Open
Conversation
当前策略已经去掉 MACD 过滤,只剩下“趋势 + 无持仓”两个条件: 从 60 根历史 K 线里计算 MA20、MA60,要求最新价 price > MA60 且 MA20 > MA60,确认处于上升趋势。 khHas(data, code) 返回 False(上一交易日收盘时没有这只股票)。 满足后 _calc_buy_ratio 按“现金×95%,但单只股票不超过账户 5%”计算买入比例,并通过 generate_signal(..., "buy") 下单。 没有其他指标过滤,买点完全由均线趋势 + 空仓判断决定 只有拖尾止损这一条: 每个持仓都记录自买入以来的最高价 highest,并计算两条保护线:highest × (1 − TRAIL_DROP_PCT) 与 highest − TRAIL_ATR_MULT × ATR,取更高者作为动态止损价。 只要当前价跌破这条拖尾线,就触发卖出。首次触发只减半仓(PARTIAL_STOP_RATIO = 0.5),若已经减半或再次触发,则把剩余仓位全部卖出。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cd12fbd