形态翻转策略通过检测K线形态,识别价格从上涨到下跌或者从下跌到上涨的转折点,在转折点附近进行买入或卖出操作。该策略主要利用影线与实体的比例关系来判断价格反转信号。
该策略的核心逻辑是检测K线的影线部分与实体部分的比例关系,来判断是否存在价格反转形态。
当出现下跌K线时,如果该K线的下影线较长,上影线和实体较短,则表示该K线有较强的买入力道,可能反转为上涨。具体来说,是检测收盘价高于开盘价,并且下影线长度大于上影线与实体长度的一定倍数,则产生多头信号。
相反,当出现上涨K线时,如果该K线的上影线较长,下影线和实体较短,则表示该K线有较强的卖出力道,可能反转为下跌。具体来说,是检测收盘价低于开盘价,并且上影线长度大于下影线与实体长度的一定倍数,则产生空头信号。
此外,若开盘价与收盘价相差很小,但影线较长,也可能产生反转信号。
检测反转信号时,还会结合平均K线范围进行过滤,只有在K线范围大于平均值时,才会产生信号。
可以考虑结合趋势指标,避免逆势操作。也可以通过与其他技术指标组合,确认反转信号。参数设置可以通过回测优化获得更好的参数组合。
形态翻转策略通过比较简单的形态识别方法,有效识别价格反转形态,捕捉转折点。但仅仅依靠单个K线形态容易产生误判,需要与其他技术指标组合使用,同时加入趋势判断,可以避免逆势操作,从而提高策略稳定性。此外,参数优化和止损/止盈设置也是进一步完善策略的方向。总之,形态翻转策略为我们提供了一个简单实用的思路,但需要配合其他技术手段才能发挥最大效果。
/*backtest start: 2023-10-08 00:00:00 end: 2023-10-15 00:00:00 period: 3m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © adiwajshing //@version=4 strategy("Wick Reversal Signal", overlay=true) wickMultiplier = input(3.25) bodyPercentage = input(0.35) barsBack = input(50) bodyMultiplier = input(1.1) myCandleSize = high-low averageCandleSize = rma(myCandleSize, barsBack) longSignal = close > open and open-low >= (close-open)*wickMultiplier and high-close <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier longSignal := longSignal or (close < open and close-low >= (open-close)*wickMultiplier and high-close <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier) longSignal := longSignal or (abs(close-open) < 0.01 and close != high and high-low >= (high-close)*wickMultiplier and high-close <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier) shortSignal = close < open and high-open >= (open-close)*wickMultiplier and close-low <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier shortSignal := shortSignal or (close > open and high-close >= (close-open)*wickMultiplier and close-low <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier) shortSignal := shortSignal or (abs(close-open) < 0.01 and close != low and high-low >= (close-low)*wickMultiplier and close-low <= (high-low)*bodyPercentage and high-low >= averageCandleSize*bodyMultiplier) plotshape(longSignal, style=shape.triangleup, size=size.normal) plotshape(shortSignal, style=shape.triangledown, size=size.normal) strategy.entry("LONG", strategy.long, when=longSignal) strategy.entry("SHORT", strategy.short, when=shortSignal)