以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  文字描述请老师编程  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=184744)

--  作者:一杯沧海
--  发布时间:2021/3/17 6:57:24
--  文字描述请老师编程

函数定义

大阳线:1、实体是前A根最大值

<!--[if !supportLists]-->2、<!--[endif]-->上影线小于等于实体的三分之一

<!--[if !supportLists]-->3、<!--[endif]-->倍量

  量:成交量是前B根平均量的C


多单策略

<!--[if !supportLists]-->1、<!--[endif]-->最新价大于480均线

<!--[if !supportLists]-->2、<!--[endif]-->大阳线

<!--[if !supportLists]-->3、<!--[endif]-->macd金叉

<!--[if !supportLists]-->4、<!--[endif]-->(大阳线收盘价-最低价+E)小于F

以上条件均满足是开仓

 

止损

收盘价小于大阳线最低价-E

120均线大于进场价格,以收盘价小于120均线止损

 

                     

空单策略

1120均线小于480均线

2120均线小于1440均线

3、收盘价小于120均线

以上条件均满足是开仓

 

止损

<!--[if !supportLists]-->1、<!--[endif]-->收盘价大于120均线

<!--[if !supportLists]-->2、<!--[endif]-->120均线大于于480均线

满足其中一项止损。

 

 

大写英文字母均为可调参数


A\\B\\C简单设置即可默认2,最低1最大3,步长1  谢谢~


--  作者:yukizzc
--  发布时间:2021/3/17 9:50:57
--  

input:A(1,1,100,1);
input:B(1,1,100,1);
input:CC(1,1,100,1);
input:E(1,1,100,1);
input:F(1,1,100,1);

DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;

cond1:close>ma(close,480);
cond2:ref((high-close)<=0.3*(close-open),hhvbars(close,A));
cond22:ref(vol>CC*ma(vol,B),hhvbars(close,A));
cond3:cross(MACD,0);
cond4:close-low+E<F;

if cond1 and cond2 and cond22 and cond3 and cond4 and holding<=0 then buy(1,1,marketr);
//止损
if close<ref(low,hhvbars(close,A))-E and ma(close,120)>enterprice and holding>0 then sell(1,holding,marketr);

 

 

 

以多头为例,cond1到4分别对应你上面四个条件,建议用户自己学习下代码看看逻辑