//分别定义了4个MA长度Input:MA_length1(4),MA_length2(12),MA_length3(22),MA_length4(60)
//分别定义了4个MA值
MA_Value1 = MA(Close, MA_length1)
MA_Value2 = MA(Close, MA_length2)
MA_Value3 = MA(Close, MA_length3)
MA_Value4 = MA(Close, MA_length4)
//求出均线粘合,他是个布尔类型的变量
均线粘合=COUNTIF(MAX(MAX(MA_Value1,MA_Value2),MA_Value3)/MIN(MIN(MA_Value1,MA_Value2),MA_Value3)<1.03,5)>=5
//设置向上突破和向下突破的条件
向上突破=MA_Value1[1]>MA_Value1[2] AND MA_Value2[1]>MA_Value2[2] AND MA_Value3[1]>MA_Value3[2] AND C>MA_Value1 AND C>MA_Value2
向下突破=MA_Value1[1]<MA_Value1[2] AND MA_Value2[1]<MA_Value2[2] AND MA_Value3[1]<MA_Value3[2] AND C<MA_Value1 AND C<MA_Value2
//成交量的条件也加上
成交量突破=V/MA(V,5)>1.5 AND MA(V,5)>MA(V,13)
If 均线粘合 Then
If MA_Value2>MA_Value3 AND MA_Value3>MA_Value4 AND MA_Value4>=MA_Value4[1] and 向上突破 and 成交量突破 Then
Buy next bar at market
End If
End If
If 均线粘合 Then
If MA_Value2<MA_Value3 AND MA_Value3<MA_Value4 AND MA_Value4<=MA_Value4[1] and 向下突破 and 成交量突破 Then
Sell next bar at market
End If
End If
你学习一下金字塔的基础教程和基础语法,就可以改了
很容易的
不要这么赖,学都不想学
难道每个问题都让别人给你解决吗,你只要“复制+黏贴”就可以了?
每个人都有自己的压力、工作和生活。
金字塔是协助你解决问题,而非代替你解决问题