Rss & SiteMap

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

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

标题:[求助]如下代码没有显示多头信号?

1楼
bhwhui 发表于:2009/10/4 0:54:38

代码如下,很简单的ma交易系统

 

input:man(26,2,200);

ma1:=ma(close,man);
ccm:=cross(close,ma1);
cmc:=cross(ma1,close);

{开多}
buy(vol>20000 and holding=0 and ccm,1);
{平多}
sell(holding>0 and cmc,1);
{开空}
buyshort(vol>20000 and holding=0 and cmc,1);
{平空}
sellshort(holding<0 and ccm,1);

 

2楼
bhwhui 发表于:2009/10/4 0:57:39


图片点击可在新窗口打开查看此主题相关图片如下:101.jpg
图片点击可在新窗口打开查看

 

如果删除空头语句,就有多头信号了,不解


图片点击可在新窗口打开查看此主题相关图片如下:102.jpg
图片点击可在新窗口打开查看
3楼
bhwhui 发表于:2009/10/4 0:58:49
是立即反手原因么?谢谢
4楼
bhwhui 发表于:2009/10/4 1:12:09

改成如下代码也不行 不明白了

input:man(26,2,200);

ma1:=ma(close,man);
ccm:=cross(close,ma1);
cmc:=cross(ma1,close);

if holding=0 then
begin
{开多}
if ccm then
begin
buy(ccm,1);
exit;
end;

{开空}
if cmc then
begin
buyshort(cmc,1);
exit;
end;
end;

{平多}
if cmc and holding>0 then
begin
sell(holding>0 and cmc,1);
exit;
end;
{平空}
sellshort(holding<0 and ccm,1);

5楼
admin 发表于:2009/10/4 1:21:52

这样写就对了,这是交易逻辑处理的问题

input:man(26,2,200);

ma1:=ma(close,man);
ccm:=cross(close,ma1);
cmc:=cross(ma1,close);

资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;

if ccm then
begin
//平空开多
sellshort(holding<0 and ccm,0);
buy(holding<=0,1);
end

if cmc then
begin
//平多开空
sell(holding>0 and cmc,0);
buyshort(holding>=0,1);
end

 

[此贴子已经被作者于2009-10-4 2:05:58编辑过]
共5 条记录, 每页显示 10 条, 页签: [1]


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