设为首页收藏本站

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

tb公式疑问,感谢解答 [复制链接]

Rank: 1

精华
0
UID
252953
积分
5
帖子
2
主题
1
阅读权限
10
注册时间
2017-6-23
最后登录
2018-1-28
跳转到指定楼层
1#
发表于 2017-9-6 11:00:56 |只看该作者 |倒序浏览
//------------------------------------------------------------------------
// 简称: tbhz280
// 名称:
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------

Params
        Numeric Lots(1);
                String        Sys("L30");//交易策略标志
                Numeric yingxian(7);//上影线长度平仓设置       
        Numeric juliang(279000);//巨量成交平仓设置       
        Numeric rbzy(92);//螺纹止盈点数
Vars
    NumericSeries MA5;
        NumericSeries MA60;
        NumericSeries MA120;
        NumericSeries MA25;

        NumericSeries Zhisun;
        NumericSeries Zhiying;       
        Bool Bfangliang;
        Bool Sfangliang;

Begin
    MA5 = Average(C,5);
        MA60 = Average(C,60);
        MA120 = Average(C,120);
        MA25 = Average(C,25);
PlotNumeric("MA5",MA5,0,Red);
        PlotNumeric("MA60",MA60,0,Blue);
        PlotNumeric("MA120",MA120,0,Rgb(255,0,255));
        PlotNumeric("MA25",MA25,0,Yellow);
       
        IF((o<=ma25 &&  o<=ma5 ) && ( c > ma5 and c > ma25 )  )
       
        {
            Buy(Lots,o);
                        buyprice = o;
                buybar = CurrentBar;

        }
       
IF((o>ma25 &&  o>ma5 ) && ( c < ma5 and c < ma25 ) && MA5<MA25 && MA25>MA60)
       
        {
             SellShort(lots,o);
             sellprice = o;
                sellbar = CurrentBar;       
        }


       


            If( h - buyprice>zhiying && CurrentBar>buybar)
        {
                Sell(lots,buyprice+zhiying);
                Commentary("100点止盈");
    }
       
    If( sellprice-l>zhiying && CurrentBar>sellbar)
        {
                BuyToCover(lots,sellprice-zhiying);
                Commentary("100点止盈");
}               
                end//------------------------------------------------------------------------
附件: 你需要登录才可以下载或查看附件。没有帐号?注册

Rank: 1

精华
0
UID
256802
积分
30
帖子
26
主题
4
阅读权限
10
注册时间
2017-9-18
最后登录
2017-12-7
2#
发表于 2017-11-4 20:59:53 |只看该作者
比如我的策略运行在1小时K线周期里面,但是我想调用日线周期里面的5日、10日、20日均线,代码怎么写

使用道具 举报

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

bottom

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

GMT+8, 2024-5-12 04:54

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部