以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求助 可以把这个模型改为金字塔的交易系统么  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=7828)

--  作者:鸟人爱理财
--  发布时间:2011/9/1 20:06:32
--  求助 可以把这个模型改为金字塔的交易系统么
//分别定义了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


--  作者:阿火
--  发布时间:2011/9/2 7:57:25
--  

你学习一下金字塔的基础教程和基础语法,就可以改了

很容易的

不要这么赖,学都不想学

难道每个问题都让别人给你解决吗,你只要“复制+黏贴”就可以了?

每个人都有自己的压力、工作和生活。

金字塔是协助你解决问题,而非代替你解决问题


--  作者:鸟人爱理财
--  发布时间:2011/9/2 9:23:58
--  
大哥说的是 自己从头好好学一下