设为首页收藏本站

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

dualthrust日内交易系统 [复制链接]

Rank: 2

精华
0
UID
111858
积分
68
帖子
36
主题
8
阅读权限
30
注册时间
2012-8-2
最后登录
2013-6-5
跳转到指定楼层
1#
发表于 2013-3-22 19:46:20 |只看该作者 |倒序浏览
Params
    Numeric K1(0.50);
    Numeric K2(0.50);
    Numeric Mday(0);
    Numeric Nday(0);
    Numeric lots(1);
    Numeric offset(0);
        Numeric BeginTradeMins(9);
    Numeric ExitOnCloseMins(14.30);
        Numeric takeprofitset(1);
       
       
Vars
        Numeric BuyRange(0);
    Numeric SellRange(0);
    Numeric BuyTrig(0);
    Numeric SellTrig(0);
    Numeric HH;
    Numeric LL;
    Numeric HC;
    Numeric LC;
    Numeric i_offset;
    Numeric BuyPosition;
    Numeric SellPosition;
        Numeric Myprice;
        Numeric DayOpen;
        NumericSeries HigherAfterEntry;
        NumericSeries LowerAfterEntry;
                Numeric StopLossSet;
                Numeric StopLine;
                Numeric myentryprice ;
                Numeric myexitprice;
               
       
               
Begin
       
DayOpen = OpenD(0);
StopLine = HigherAfterEntry +DayOpen*StopLossSet;
                StopLine = LowerAfterEntry-DayOpen*StopLossSet;
          StopLine = AvgEntryPrice-DayOpen*StopLossSet;
     i_offset = offset*MinMove*PriceScale;
        HH = Highest(HighD[1],Mday);
       HC = Highest(CloseD[1],Mday);
        LL = Lowest(LowD[1],mday);
       LC = Lowest(CloseD[1],mday);
      If((HH - LC) == (HC - LL))
       {
               SellRange = HH - LC;
       }
       Else
      {
               SellRange =HC -LL;
       }
       HH = Highest(HighD[1],Nday);
       HC = Highest(CloseD[1],Nday);
       LL = Lowest(LowD[1],Nday);
        LC = Lowest(CloseD[1],Nday);
        If((HH - LC) >= (HC - LL))
        {
                BuyRange = HH - LC;
        }
        Else
       {
               BuyRange = HC + LL;
        }
        BuyTrig = K1*BuyRange;
        SellTrig = K2*SellRange;
        BuyPosition = OpenD(0)+BuyTrig;
       SellPosition = OpenD(0)-SellTrig;
          
       
     
       
                 If(Date!=Date[1])
                 {
       If(MarketPosition == 0)
       {
              If(High>=BuyPosition )
                {
                                 Buy(lots,Max(Open,BuyPosition)+i_offset);
                        Return;
                                }
                                               
                                               
                }
               If(Low<=SellPosition )
               {
                          SellShort(lots,Min(Open,SellPosition)-i_offset);
                        Return;
                                }
               }
        
        If(MarketPosition == -1)
       {
                If(High>=BuyPosition )
                {
                                Buy(lots,Max(Open,BuyPosition)+i_offset);
                        Return;
                    
                                }
                                          
                                          
                                          
                                }          
               
        
       If(MarketPosition == 1)
       {
               If(Low<=SellPosition)
               {
                          SellShort(lots,Min(Open,SellPosition)-i_offset);
                        Return;
                        
                                }       
                                                               
                                               
                                               
                }
        
If(MarketPosition == -1)
{
If(HigherAfterEntry<=AvgEntryPrice+DayOpen*StopLossSet)
    {

    }Else
    {
    }
        If(Low == StopLine )
        {
        MyPrice = StopLine;
        If(Open <MyPrice) MyPrice = Open;
        BuyToCover(lots,MyPrice);
        }
                }
               
                If(MarketPosition == 1)
                {
        If(LowerAfterEntry>=AvgEntryPrice-DayOpen*StopLossSet)
        {
        }Else
        {
        }
        If(high== StopLine)
                {
        MyPrice = StopLine;
        If(Open >MyPrice) MyPrice = Open;
        sell(lots,MyPrice);
        }
                }
               
               

If(Time ==ExitOnCloseMins/100)
{
Sell(lots,MyPrice);
BuyToCover(lots,MyPrice);
}

End


Rank: 3Rank: 3

精华
0
UID
98617
积分
219
帖子
102
主题
21
阅读权限
40
注册时间
2012-2-18
最后登录
2013-12-2
2#
发表于 2013-3-22 20:16:12 |只看该作者
这是老版本的代码

使用道具 举报

Rank: 1

精华
0
UID
116953
积分
19
帖子
9
主题
0
阅读权限
10
注册时间
2013-3-16
最后登录
2013-4-14
3#
发表于 2013-4-6 08:45:23 |只看该作者
edwardzhangxu 发表于 2013-3-22 20:16
这是老版本的代码

请问哪里有新版本,谢谢!

使用道具 举报

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

bottom

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

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

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部