设为首页收藏本站

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

模型提示return返回类型不对 [复制链接]

Rank: 1

精华
0
UID
191387
积分
2
帖子
1
主题
1
阅读权限
10
注册时间
2014-7-28
最后登录
2017-3-2
跳转到指定楼层
1#
发表于 2017-3-1 17:25:36 |只看该作者 |倒序浏览
Params
Numeric K1(0.5);
Numeric K2(0.5);
Numeric Mday(1);
Numeric Nday(1);
Numeric lots(1);
Numeric offset(0);

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;

Begin  
     
     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);
//计算BuyRange和SellRange
     if((HH-LC)>=(HC-LL))
   {
              SellRange=HH-LC;
   
    }
        Else
   {
              SellRange=HH-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=HH-LL;
    }
//计算通道上下轨
    BuyTrig=K1*BuyRange;
    SellTrig=K2*SellRange;

    BuyPosition=OpenD(0)+BuyTrig;
    SellPosition=OpenD(0)+SellTrig;
    PlotNumeric("BuyPosition",BuyPosition);
    PlotNumeric("SellPosition",SellPosition);
//入场条件:突破上轨反手多,突破下轨反手空
    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(Low<=SellPosition)
            {
                    SellShort(lots,Min(Open,SellPosition)-i_offset);
                    Return;
             }
    }
End
您需要登录后才可以回帖 登录 | 注册

bottom

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

GMT+8, 2024-4-19 15:41

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部