以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请老师吧交易系统改成指标带信号的  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=142376)

--  作者:第一魔尊
--  发布时间:2016/11/8 16:50:39
--  请老师吧交易系统改成指标带信号的

runmode:0;

input:length1(10,5,60,5);
input:length2(5,5,60,5);

ama:=md(close,length1);

ama1:=ema(ama,length2);

entrylongcond:=ref(cross(ama,ama1),1);
entryshortcond:=ref(cross(ama1,ama),1);

if holding=0 then begin
 if entrylongcond then
  buy(1,1,limitr,open);
end

if holding=0 then begin
 if entryshortcond then
  buyshort(1,1,limitr,open);
end

if holding>0 then begin
 if entryshortcond then begin
  sell(1,holding,limitr,open);
  buyshort(1,1,limitr,open);
 end
end

if holding<0 then begin
 if entrylongcond then begin
  sellshort(1,holding,limitr,open);
  buy(1,1,limitr,open);
 end
end

盈亏:asset-50000,noaxis,colorred,linethick2;


--  作者:jinzhe
--  发布时间:2016/11/8 16:54:14
--  

 

input:length1(10,5,60,5);
input:length2(5,5,60,5);

ama:=md(close,length1);

ama1:=ema(ama,length2);

entrylongcond:=ref(cross(ama,ama1),1);
entryshortcond:=ref(cross(ama1,ama),1);

drawtext(cross(entrylongcond,0.5),h,\'买入\'),pxup20;
drawtext(cross(entryshortcond,0.5),l,\'卖出\'),pxdn10;


--  作者:第一魔尊
--  发布时间:2016/11/15 18:05:51
--  
谢谢
[此贴子已经被作者于2016-11-15 18:07:02编辑过]

--  作者:第一魔尊
--  发布时间:2016/11/15 18:50:55
--  
怎么看到指标计算出来的线呢,能显示出来嘛
--  作者:jinzhe
--  发布时间:2016/11/16 8:53:35
--  

ama:=md(close,length1);

ama1:=ema(ama,length2);

 

去掉两个等号即可