Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共9 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请老师编写个策略

1楼
sunjach 发表于:2017/7/19 11:24:02
当收盘价同时向上穿越10日和5日MA时,开多
当收盘价同时向下穿越10日和5日MA时,开空
附加条件: 穿越当根K线的最高至最低幅度在15跳范围内,才满足开仓条件
止盈条件:当开仓价格大于15个点时,才触发止损条件保本,启动移动止盈跟踪,即 例如,3500开多,现价超过3515时,开始启动保本跟踪止盈
止损条件:当现价亏损达到15个点时,直接止损。
2楼
pyd 发表于:2017/7/19 12:32:53
编写中请稍等
3楼
pyd 发表于:2017/7/19 12:46:17


多头为例,空头你参照着写

VARIABLE:n=0;
ma5:ma(c,5);
ma10:ma(c,10);
kd:=cross(c,ma5) and cross(c,ma10);
kk:=cross(ma5,c) and cross(ma10,c);
if kd and h-l<=15*mindiff and holding=0 then buy(1,1,marketr);
if kk and h-l<=15*mindiff and holding=0 then buyshort(1,1,marketr);
if hhv(h,enterbars+1)-enterprice>=15 then n:=1;
if n=1 and c-enterprice>=15 and holding>0 then begin
sell(1,1,marketr);
n:=0;
end

if enterprice-c>=15 and holding>0 then sell(1,1,marketr);

4楼
sunjach 发表于:2017/7/19 13:45:22
不好意思 老师,自己还不会呢,才试着看,您帮我先写下了,谢谢!
5楼
pyd 发表于:2017/7/19 14:07:47

学习资料http://www.weistock.com/bbs/dispbbs.asp?boardid=2&Id=55146

VARIABLE:n=0,m=0;
ma5:ma(c,5);
ma10:ma(c,10);
kd:=cross(c,ma5) and cross(c,ma10);
kk:=cross(ma5,c) and cross(ma10,c);

if kd and h-l<=15*mindiff and holding=0 then buy(1,1,marketr);//开多

if hhv(h,enterbars+1)-enterprice>=15 then n:=1;
if n=1 and c-enterprice<=15 and holding>0 then begin //多头移动止盈
sell(1,1,marketr);
n:=0;
end

if enterprice-c>=15 and holding>0 then sell(1,1,marketr); //多头止损
 

if kk and h-l<=15*mindiff and holding=0 then buyshort(1,1,marketr);//开空

if enterprice-llv(l,enterbars+1)>=15 then m:=1;
if m=1 and enterprice-c<=15 and holding<0 then begin  //空头移动止盈
sellshort(1,1,marketr);
m:=1;
end

if c-enterprice>=15 and holding<0 then sell(1,1,marketr);//空头止损

6楼
sunjach 发表于:2017/7/19 14:16:12
老师,还有个条件忘记了,就是开仓条件的反向条件出现时,也是平掉原有的仓。例如,阳K线穿双线开了多单,反过来阴线反穿双均线时,也要平仓,如果满足开空条件时,直接反手。
7楼
wenarm 发表于:2017/7/19 14:50:11

你这非条件不是已经被你上面的条件包含了吗?

上穿两个均线的k,不管是红还都会开仓的,平仓条件也是一样的

[此贴子已经被作者于2017/7/19 15:01:52编辑过]
8楼
sunjach 发表于:2017/7/19 15:54:38
开仓条件有一个点数限制,平仓要反向条件出现,先平仓再判断是否符合开仓
9楼
wenarm 发表于:2017/7/19 16:23:31

不明白你说的,。你一把条件从新整理说明,并详细表达每个条件之间的关系

共9 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.12500 s, 3 queries.