设为首页收藏本站

 找回密码
 注册
楼主: kgy000
打印 上一主题 下一主题

请求帮助: [复制链接]

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
1#
发表于 2009-12-14 11:18:15 |显示全部楼层
Vars
        NumericSeries diff;
        NumericSeries dea;
        NumericSeries lon;
        Numeric vid;
        NumericSeries rc;
        NumericSeries mlong;
Begin
       
       
        If(BarStatus==0)
                mlong=0;
        Else If(CurrentBar>=2)
        {
               
                vid=Summation(Vol,2)/((Highest(HIGH,2)-Lowest(LOW,2))*100);
                rc=(Close-Close[2])*vid;
                //mlong=rc+mlong[1];
       
                mlong=Summation(rc,CurrentBar+1);
                diff=SMA(mlong,15,1);
                dea=SMA(mlong,20,1);
                lon=diff-dea;
                If(CrossOver(lon,0))
                {
                        Buy(1,0);
                }Else If(CrossUnder(lon,0))
                {
                        SellShort(1,0);
                }
        }
Commentary("rc="+Text(rc));
Commentary("mlong="+Text(mlong));
End

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
2#
发表于 2009-12-14 23:33:49 |显示全部楼层
ref(close,1)相当于close[1],即表示上一个bar的收盘价

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
3#
发表于 2009-12-15 12:06:19 |显示全部楼层
已修改,请看3楼

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
4#
发表于 2009-12-30 11:00:34 |显示全部楼层
条件满足了没有信号?

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
5#
发表于 2009-12-30 17:04:21 |显示全部楼层
你是指后面满足条件后没有开仓是吗?
您的交易设置限制了开仓手数

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
6#
发表于 2009-12-31 10:06:28 |显示全部楼层
已解决

Vars
        NumericSeries diff;
        NumericSeries dea;
        NumericSeries lon;
        Numeric vid;
        NumericSeries rc;
        NumericSeries mlong;
Begin
        
        
        If(BarStatus==0)
                mlong=0;
        Else If(CurrentBar>=2)
        {
                If(high==Low)
                                        vid=0;
                                Else
                                        vid=Summation(Vol,2)/((Highest(HIGH,2)-Lowest(LOW,2))*100);
                rc=(Close-Close[2])*vid;
                //mlong=rc+mlong[1];
        
                mlong=Summation(rc,CurrentBar+1);
                diff=SMA(mlong,15,1);
                dea=SMA(mlong,20,1);
                lon=diff-dea;
                If(CrossOver(lon,0))
                {
                        Buy(1,0);
                }Else If(CrossUnder(lon,0))
                {
                        SellShort(1,0);
                }
        }
Commentary("vid="+Text(vid));
Commentary("CurrentBar="+Text(CurrentBar));
Commentary("mlong="+Text(mlong));
Commentary("rc="+Text(rc));
End

配合以下指标,可以查看lon
Params
        
Vars
        NumericSeries diff;
        NumericSeries dea;
        NumericSeries lon;
        Numeric vid;
        NumericSeries rc;
        NumericSeries mlong;
Begin
        If(BarStatus==0)
                mlong=0;
        Else If(CurrentBar>=2)
        {
                If(high==Low)
                                        vid=0;
                Else
                        vid=Summation(Vol,2)/((Highest(HIGH,2)-Lowest(LOW,2))*100);
                rc=(Close-Close[2])*vid;
                mlong=Summation(rc,CurrentBar+1);
                diff=SMA(mlong,15,1);
                dea=SMA(mlong,20,1);
                lon=diff-dea;
        }
        PlotNumeric("line",0);
        PlotNumeric("lon",lon);
End

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
2
UID
4130
积分
20901
帖子
6519
主题
17
阅读权限
200
注册时间
2009-4-15
最后登录
2019-4-12
7#
发表于 2009-12-31 10:09:58 |显示全部楼层
原因是因为有两个bar的最高和最低相等,导致出错
tb和通达信不同,k线小结时间不同等等一些因素,会导致在信号上会有点差异,毕竟是两个软件

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-18 08:50

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部