本策略结合不同时间段的动量指标,实现在多个时间尺度判断市场趋势反转的能力。策略利用Stochastic oscillator判断短期趋势反转点,并结合较长周期的(最高价-最低价)/收盘价指标判断中长期趋势,实现在多个时间维度判断趋势反转的能力。
策略由两部分组成:
该部分通过Stochastic oscillator的快线和慢线交叉来判断短期趋势反转。具体来说,如果收盘价较前一日收高,且Stochastic的快线低于慢线且快线低于50,则做多;如果收盘价较前一日收低,且Stochastic的快线高于慢线且快线高于50,则做空。该策略利用Stochastic判断短期超买超卖状态,实现短线反转交易。
该指标反映当前K线的波动性。指标值较大时表示当前波动加大,可能反转;指标值较小时表示当前波动减弱,趋势可能持续。策略利用该指标的SMA值判断中长线趋势反转。
综合两个指标,可以在短期和中长期同时判断趋势反转,实现多时间尺度的交易策略。
策略同时利用短期和中长期指标,可以确保反转信号的可靠性,避免单一指标造成的假信号。
Stochastic oscillator和(最高价-最低价)/收盘价指标的参数都可以根据市场调整,使策略更具灵活性。
策略以Stochastic为核心,辅以中长期趋势判断,结构简单清晰,易于理解和修改。
策略框架简单通用,可方便地引入更多指标,构建多因子模型。
策略以反转为主,在持续趋势市场中表现可能不佳。应适当调整参数以适应趋势市场。
在异常市场情况下,Stochastic 和 (最高价-最低价)/收盘价指标可能发出错误信号,需要防范假信号风险。
Stochastic 和 (最高价-最低价)/收盘价指标的参数需要根据市场情况优化,否则可能影响策略表现。
策略为反转策略,盈亏波动可能较大,需要控制好仓位和风险。
可在现有框架下引入更多因子,如成交量、其它反转指标等,构建多因子模型。
可设定移动止损或时间止损,有效控制单笔交易的损失。
可以通过更系统的方法如遗传算法等手段对参数进行优化。
应用机器学习算法训练判断趋势反转的模型可能进一步提高准确率。
引入社交数据等非结构化数据的情感分析,辅助预测反转点。
本策略整合短期和中期两个时间维度的指标来实现多时间段判断趋势反转,是一个非常好的反转策略框架。具有指标参数灵活、结构简单、扩展性强等优点。下一步可以从引入更多因子、参数优化、止损以及机器学习等方面进行改进,使策略的盈利能力和风险控制能力进一步提升。总体来说,该策略思路新颖,值得深入研究与应用。
//@version=3 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 23/05/2019 // This is combo strategies for get // a cumulative signal. Result signal will return 1 if two strategies // is long, -1 if all strategies is short and 0 if signals of strategies is not equal. // // First strategy // This System was created from the Book "How I Tripled My Money In The // Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies. // The strategy buys at market, if close price is higher than the previous close // during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. // The strategy sells at market, if close price is lower than the previous close price // during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50. // // Second strategy // This histogram displays (high-low)/close // Can be applied to any time frame. // // WARNING: // - For purpose educate only // - This script to change bars colors. //////////////////////////////////////////////////////////// Reversal123(Length, KSmoothing, DLength, Level) => vFast = sma(stoch(close, high, low, Length), KSmoothing) vSlow = sma(vFast, DLength) pos = 0.0 pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1, iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) pos HLCHist(input_barsback, input_percentorprice, input_smalength) => xPrice = (high-low)/close xPriceHL = (high-low) xPrice1 = iff(input_percentorprice, xPrice * 100, xPriceHL) xPrice1SMA = sma(abs(xPrice1), input_smalength) pos = 0.0 pos := iff(xPrice1SMA[input_barsback] > abs(xPrice1), 1, iff(xPrice1SMA[input_barsback] < abs(xPrice1), -1, nz(pos[1], 0))) pos strategy(title="Combo Backtest 123 Reversal & (H-L)/C Histogram", shorttitle="Combo", overlay = true) Length = input(14, minval=1) KSmoothing = input(1, minval=1) DLength = input(3, minval=1) Level = input(50, minval=1) //------------------------- input_barsback = input(4, title="Look Back") input_percentorprice = input(false, title="% change") input_smalength = input(13, title="SMA Length") reverse = input(false, title="Trade reverse") posReversal123 = Reversal123(Length, KSmoothing, DLength, Level) posHLCHist = HLCHist(input_barsback, input_percentorprice, input_smalength) pos = iff(posReversal123 == 1 and posHLCHist == 1 , 1, iff(posReversal123 == -1 and posHLCHist == -1, -1, 0)) possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos)) if (possig == 1) strategy.entry("Long", strategy.long) if (possig == -1) strategy.entry("Short", strategy.short) if (possig == 0) strategy.close_all() barcolor(possig == -1 ? red: possig == 1 ? green : blue )