创富综合策略

Author: ChaoZhang, Date: 2023-11-01 16:28:55
Tags:

创富综合策略

概述

本策略是一种综合性的交易策略,其目的是在中短期内获利。它整合了123反转策略和神奇振荡器策略,以发挥两者的优势,获取更可靠的交易信号。

策略原理

该策略由两部分组成:

123反转策略

这部分策略基于书籍“我如何在期货市场上使资金增长三倍”第183页所述的反转策略改编。它在以下情况下做多:如果收盘价连续2天高于前一日收盘价,且9日随机慢线低于50时;它在以下情况下做空:如果收盘价连续2天低于前一日收盘价,且9日随机快线高于50时。

神奇振荡器策略

该部分策略使用神奇振荡器指标,它将AO当前值与上一期的值进行对比。如果当前AO值高于上一期,则视为适合做多,柱形显示为蓝色;如果当前AO值不高于上一期,则视为适合做空,柱形显示为红色。

综合信号生成规则是:如果123反转策略和神奇振荡器策略同时发出买入信号,则采取做多策略;如果两者同时发出卖出信号,则采取做空策略。

优势分析

该综合策略最大的优势在于整合了两种不同类型策略的优点,可以提高信号的可靠性和稳定性。

具体来说,123反转策略在中短期内较为适用,可以捕捉反转机会。而神奇振荡器策略则更注重短期趋势,灵敏度较高。两者互为补充,可以过滤掉一些假信号,同时也可以在不同阶段捕捉较优的入场时机。

另外,该策略综合利用K线信息和振荡器指标,兼顾了价格行情本身的信息和量价关系,比较全面和立体。

风险分析

该策略最大的风险在于,综合多个策略也意味着综合了各自的风险。

123反转策略本身并不能完全避免被困于震荡市场的风险。神奇振荡器策略对短期市场波动也较为敏感。如果两者发出错误信号,则会乘二为害。

此外,参数设置也会影响策略效果。需要反复测试和优化,找到最佳参数组合。

要规避风险,可以适当调整策略持仓规模,降低单笔交易的风险敞口。另外,可设置止损线,避免损失进一步扩大。

优化方向

可以从以下几个方面进一步优化该策略:

  1. 测试并优化参数,找到最优参数组合

  2. 增加其他指标或过滤条件,进一步提高信号质量

  3. 结合不同时间周期进行多时间框架优化

  4. 增加动态止损策略,更好控制风险

  5. 考虑实际交易成本,设定进入和退出的条件

  6. 考虑大级别趋势方向,避免逆势操作

总结

本策略综合运用123反转和神奇振荡器两大策略的优点,在提高信号可靠性的同时,保留了一定的灵活性和对市场变化的敏感度。但仍需进一步优化参数,严格控制风险,方能在实盘中稳定获利。整体来说,该策略具有很好的中短期交易潜力,值得进一步研究与应用。


/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-31 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 09/08/2021
// This is combo strategies for get a cumulative signal. 
//
// 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 indicator plots the oscillator as a histogram where blue denotes 
//    periods suited for buying and red . for selling. If the current value 
//    of AO (Awesome Oscillator) is above previous, the period is considered 
//    suited for buying and the period is marked blue. If the AO value is not 
//    above previous, the period is considered suited for selling and the 
//    indicator marks it as red.
//
// 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


BWAC(nLengthSlow,nLengthFast) =>
    pos = 0.0
    xSMA1_hl2 = sma(hl2, nLengthFast)
    xSMA2_hl2 = sma(hl2, nLengthSlow)
    xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
    xSMA_hl2 = sma(xSMA1_SMA2, nLengthFast)
    nRes =  xSMA1_SMA2 - xSMA_hl2
    pos:= iff(nRes > nRes[1], 1,
             iff(nRes < nRes[1], -1, nz(pos[1], 0)))  
    pos

strategy(title="Combo Backtest 123 Reversal & Awesome Oscillator (AC)", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Awesome Oscillator (AC) ----")
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBWAC = BWAC(nLengthSlow,nLengthFast)
pos = iff(posReversal123 == 1 and posBWAC == 1 , 1,
	   iff(posReversal123 == -1 and posBWAC == -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 ? #b50404: possig == 1 ? #079605 : #0536b3 )

更多内容