illidanyl 发表于 2011-7-26 17:06:36

【跟风发套系统】道氏理论系统分享

跟穿堂风一个群的 平时喜欢琢磨点系统 我看流氓风分享了好几套系统了 我也跟风发一个吧~
道氏理论大家应该都很熟悉
不太清楚的同志请自己搜索下 这个东西是套很经典的系统
因为我是做日内的 所以写成了日内交易 有兴趣的朋友可以改成中长线的系统
代码如下
//------------------------------------------------------------------------
// 简称: D1
// 名称: 道氏理论
// 类别: 交易指令
// 类型: 多头建仓
// 输出:
//------------------------------------------------------------------------

Params
        Numeric ATime(918);
        Numeric CTime(1510);
        Numeric Lot(1);
        Numeric MoneyLoss(0.6);
        Numeric BarCross(1);
        Numeric Length(5);
       
Vars
        Numeric bTime(0);
        Numeric MyClose(0);
        Numeric MyDiff(0);
        NumericSeries estP(0);
        NumericSeries ExitP(0);
        NumericSeries Position(0);
        NumericSeries est(0);
        NumericSeries est1(0);
        NumericSeries est2(0);
        NumericSeries est3(0);
       
        Bool bTimeCon;
        Bool BarUpCon;
        Bool BarDownCon;
        Bool BarExitCon;
        Bool LongOpenCon;
        Bool ShortOpenCon;
        Bool LongExitCon;
        Bool ShortExitCon;
       
Begin
       
        If (Date != Date)
                {
                        est = Open;
                        est1 = Open;
                        est2 = Open;
                        est3 = Open;
                        estP = 0;
                        ExitP = 0;
                        Position = 0;
                        MyClose = Open;
                }
        Else
                {
                        est = est;
                        est1 = est1;
                        est2 = est2;
                        est3 = est3;
                        estP = estP;
                        ExitP = ExitP;
                        Position = Position;
                        If(Length != 0) MyClose = Average(Close,Length);
                        Else MyClose = Close;
                }
               
        MyDiff = MyClose * BarCross / 1000;
       
        bTime = IntPart(Time*10000);
        bTimeCon = (bTime > ATime) And (bTime < CTime);
       
        If((MyClose < est And MyClose < est1) Or (MyClose > est And MyClose > est1)) est = MyClose;
        If(((MyClose - est) > MyDiff And est < est1) Or ((est - MyClose) > MyDiff And est > est1))
                {
                        est3 = est2;
                        est2 = est1;
                        est1 = est;
                        est = MyClose;
                }
               
        If(Position > 0 And High > estP) estP = High;
        If(Position < 0 And Low < estP) estP = Low;
        If(Position > 0) ExitP = estP * (100 - MoneyLoss) / 100;
        If(Position < 0) ExitP = estP * (100 + MoneyLoss) / 100;
       
        If(bTime >= CTime)
        {
                If (Position > 0)
                        Sell(lot,Open);
                Else
                        BuyToCover(lot,Open);
        }
         
        If(bTimeCon)
        {
                If (Position == 0)
                {
                        If(est3 < est1 And (est2 / 2000 + est2) <= est And est3 < est2)
                        {
                                Buy(lot,Open);
                                Position = lot;
                                estP = Open;
                                ExitP = estP * (100 - MoneyLoss) / 100;
                                Commentary("LongOpen");
                               
                        }
                         
                        Else If(est3 > est1 And (est2 - est2 / 2000) >= est And est3 > est2)
                        {
                                SellShort(lot,Open);
                                Position = lot * -1;
                                estP = Open;
                                ExitP = estP * (100 + MoneyLoss) / 100;
                                Commentary("ShortOpen");
                        }
                }
               
                Else
               
                {
                        If(Position > 0 And est3 > est1)
                        {
                                Sell(lot,Open);
                                Position = 0;
                                Commentary("LongExit1");
                        }
                       
                        Else If(Position < 0 And est3 < est1)
                        {
                                BuyToCover(lot,Open);
                                Position = 0;
                                Commentary("ShortExit1");
                        }
                       
                        Else If(Position > 0 And Open < ExitP)
                        {
                                Sell(lot,Open);
                                Position = 0;
                                Commentary("LongExit2");
                        }
                       
                        Else If(Position < 0 And Open > ExitP)
                        {
                                BuyToCover(lot,Open);
                                Position = 0;
                                Commentary("ShortExit2");
                        }
                }
        }
       
        Commentary("Position = "+Text(Position));
        Commentary("ExitP = "+Text(ExitP));
End

//------------------------------------------------------------------------
// 编译版本        GS2004.06.12
// 用户版本        2011/05/03 13:21
// 版权所有        illidanyl
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

illidanyl 发表于 2011-7-26 17:08:57

中间有些资金控制的东西 不修改任何参数的日内结果如下 大家图个乐吧~

穿堂风 发表于 2011-7-26 17:34:26

快把压箱底的交出来{:4_205:}

tsdaquan 发表于 2011-7-26 20:06:40

我的测试结果怎么和版主的不一样?

illidanyl 发表于 2011-7-27 08:30:48

快把压箱底的交出来
穿堂风 发表于 2011-7-26 17:34 http://www.tradeblazer.net/forum/images/common/back.gif


    才不要 -v-
{:4_208:}

illidanyl 发表于 2011-7-27 08:32:17

我的测试结果怎么和版主的不一样?
tsdaquan 发表于 2011-7-26 20:06 http://www.tradeblazer.net/forum/images/common/back.gif

唔 应该是我改参数了?
反正这套东西很长时间了 你可以看公式的编译时间  是5月份的 自己做下参数优化嘛~~

lzl563 发表于 2011-8-22 23:32:34

啥品种的来。。顶起先。。

ww123 发表于 2011-8-24 12:03:54

快把压箱底的交出来
穿堂风 发表于 2011-7-26 17:34 http://www.tradeblazer.net/forum/images/common/back.gif


    你也把压箱底的交出来呀,

lzl563 发表于 2011-8-24 14:49:23

没看懂。。。。。

shp7566 发表于 2011-10-23 18:57:37

穿堂风原来是流氓风啊
页: [1] 2 3
查看完整版本: 【跟风发套系统】道氏理论系统分享