以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (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=161874)

--  作者:liookioo
--  发布时间:2018/3/6 13:54:04
--  图表没有显示开空

input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);//参数设置

DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA  : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA), COLORSTICK;


if macd1>1 and c>ma(c,120) then 
begin
buy(holding=0,1,MARKET);
end

if macd1<1 and c<ma(c,120) then
begin
sell(holding>0,holding,MARKET);
end

cond1:ENTERPRICE-c>15*MINDIFF;
cond2:c-ENTERPRICE>50*MINDIFF;

止损1:sell(holding>0 and cond1,holding,market);
止盈1:sell(holding>0 and cond2,holding,market);

用这个图标没有开空请老师帮我补充一下,当价格在120日均线之下,MACD小于1开空;

--  作者:FireScript
--  发布时间:2018/3/6 15:50:54
--  

input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);//参数设置

DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA  : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA), COLORSTICK;


if macd1>1 and c>ma(c,120) then
begin
sellshort(holding<0,holding,market);
buy(holding=0,1,MARKET);
end

if macd1<1 and c<ma(c,120) then
begin
sell(holding>0,holding,MARKET);
buyshort(holding=0,1,market);
end

cond1:ENTERPRICE-c>15*MINDIFF;
cond2:c-ENTERPRICE>50*MINDIFF;

止损1:sell(holding>0 and cond1,holding,market);
止盈1:sell(holding>0 and cond2,holding,market);
 

建议学习下代码的基本编写,这样才能自行实现自己的策略。
--  作者:liookioo
--  发布时间:2018/3/6 17:44:47
--  
谢谢老师,会用心学习,把自己的想法表达在图标上
--  作者:liookioo
--  发布时间:2018/3/6 18:16:23
--  
老师这个系统应用到一分钟图上需要怎么修改,麻烦了,谢谢;
--  作者:liookioo
--  发布时间:2018/3/6 18:19:46
--  
还是直接修改参数
--  作者:liookioo
--  发布时间:2018/3/6 18:22:11
--  
已经解决了,修改了一下参数,有显示了;