设为首页收藏本站

 找回密码
 注册
查看: 1843|回复: 0
打印 上一主题 下一主题

系统调试的问题,请帮忙看看,谢谢 [复制链接]

Rank: 3Rank: 3

精华
0
UID
11672
积分
179
帖子
59
主题
19
阅读权限
40
注册时间
2010-6-5
最后登录
2019-5-28
跳转到指定楼层
1#
发表于 2012-4-17 22:31:59 |只看该作者 |倒序浏览
写了个简单的代码想看看交易开拓者的运行机制,头根K线开仓,根据前个K线的最低价调整止损
代码如下:
Params
    Numeric stoploss(30);
Vars
        Bool Con1;
        Bool movestop;
        NumericSeries longstop;

Begin
        Con1 = MarketPosition==0;
        //始终开多头入场
        if (Con1)
        {
                Buy(1,Open+10);
                longstop=EntryPrice-stoploss;
                fileappend("e:\\text.txt"," the entry price is "+Text(EntryPrice));
        }
       
       
        if (MarketPosition==1)
        {
                movestop=Low[1]-stoploss>=longstop;
                if(movestop)
                {
                        longstop=Low[1]-stoploss;
                }
                Else
                {
                        longstop=longstop[1];
                }
               
                FileAppend("e:\\text.txt","the stop number is "+Text(longstop)+" the last low is "+Text(low[1])+" the entry price is "+Text(EntryPrice));
               
               
        }
End
去看日志文件发现开仓了两次,请帮忙看看,谢谢!
PS:
我的前几行日志如下
the entry price is 25720
the stop number is 25690 the last low is 25225 the entry price is 25720
the entry price is 25300
the stop number is 25690 the last low is 25225 the entry price is 25300
the stop number is 25690 the last low is 25234 the entry price is 25300
the stop number is 25690 the last low is 25319 the entry price is 25300
the stop number is 25690 the last low is 25296 the entry price is 25300
您需要登录后才可以回帖 登录 | 注册

bottom

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

GMT+8, 2024-5-21 15:28

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部