以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请帮写个加仓模型  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=78118)

--  作者:qaz88
--  发布时间:2015/4/29 10:34:56
--  请帮写个加仓模型
老师好!请帮写个加仓模型.做罗纹钢.要求如下:
MACD指标金叉开多.死叉开空.周期一分钟.金叉开多买入1手.设置止盈20个点.止损10.如止损平仓.下次开空2手设止盈20止损10.一直等有盈利20点平仓出局.下次又重开仓1手.(毎次止损平仓加倍反向买入)(每次止盈出局又重新按MACD金叉及死叉开多空仓1手)

--  作者:jinzhe
--  发布时间:2015/4/29 10:43:39
--  
处理中请稍等
--  作者:pyd
--  发布时间:2015/4/29 10:51:39
--  
macd里谁和谁的金叉死叉?
--  作者:qaz88
--  发布时间:2015/4/29 10:57:13
--  

MACD指标做罗纹模型当指标金叉开多.死叉开空.周期一分钟.金叉开多买入1手.设置止盈20个点.止损10.如止损平仓.下次开空2手设止盈20止损10.一直等有盈利20点平仓出局.下次又重开仓1手.(毎次止损平仓加倍反向买入)(每次止盈出局又重新按MACD金叉及死叉开多空仓1手)

--  作者:pyd
--  发布时间:2015/4/29 11:10:24
--  
macd里diff和dea的金叉死叉吗?
--  作者:qaz88
--  发布时间:2015/4/29 11:16:35
--  
对的
--  作者:pyd
--  发布时间:2015/4/29 11:40:29
--  

VARIABLE:n=0,m=0,ks=1,ds=1;
p:=26;
s:=12;
m:=9;
DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA  : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA),COLORSTICK;
jc:cross(diff,dea);
sc:cross(dea,diff);

if jc and holding=0 then begin
buy(1,ds,market);
end
if h-enterprice>=20  and enterbars>0 then begin
sell(holding>0,holding,market);//多盈
n:=0;
end
if n=0 then ks:=1;
if enterprice-l>=10  and enterbars>0 then begin //多损
sell(holding>0,holding,market);
n:=1;
end
if n=1 then ks:=2;
if sc  then begin
buyshort(holding=0,ks,market);
end


if enterprice-l>=20 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空赢
m:=0;
end
if m=0 then ds:=1;
if h-enterprice>=10 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空损
m:=1;
end
if m=1 then ds:=2;

[此贴子已经被作者于2015/4/29 13:03:01编辑过]

--  作者:qaz88
--  发布时间:2015/4/29 12:17:25
--  
老师在编写吗??
--  作者:pyd
--  发布时间:2015/4/29 13:03:32
--  

VARIABLE:n=0,m=0,ks=1,ds=1;
p:=26;
s:=12;
m:=9;
DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA  : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA),COLORSTICK;
jc:cross(diff,dea);
sc:cross(dea,diff);

if jc and holding=0 then begin
buy(1,ds,market);
end
if h-enterprice>=20  and enterbars>0 then begin
sell(holding>0,holding,market);//多盈
n:=0;
end
if n=0 then ks:=1;
if enterprice-l>=10  and enterbars>0 then begin //多损
sell(holding>0,holding,market);
n:=1;
end
if n=1 then ks:=2;
if sc  then begin
buyshort(holding=0,ks,market);
end


if enterprice-l>=20 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空赢
m:=0;
end
if m=0 then ds:=1;
if h-enterprice>=10 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空损
m:=1;
end
if m=1 then ds:=2;

 


--  作者:qaz88
--  发布时间:2015/4/29 14:29:21
--  
老师在编写吗??