设为首页收藏本站

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

求助 老师 [复制链接]

Rank: 1

精华
0
UID
253414
积分
7
帖子
6
主题
1
阅读权限
10
注册时间
2017-7-4
最后登录
2017-8-15
跳转到指定楼层
1#
发表于 2017-7-18 09:23:08 |只看该作者 |倒序浏览
可以帮忙加个止盈吗 分别以开仓价2点4点6点逐步平仓 学生跪谢了
//------------------------------------------------------------------------
// 简称: CL_JailBreakSys_L
// 名称: 基于价格区间突破的交易系统
// 类别: 公式应用
// 类型: 内建应用
// 输出:
// 策略说明:                基于通道突破的判断
// 系统要素:
//                                1. 计算10根k线最高价的区间
//                                2. 计算6根k线最低价的区间
//                               
// 入场条件:
//                            1.价格高于10根K线最高价的区间入场
// 出场条件:
//                                1. 当前价格低于6根K线最低价的区间出场
//                                2. 当前价格低于入场价一定ATR波动率幅度出场
//
//----------------------------------------------------------------------//
Params
        Numeric Length1(10);                                                                //长周期区间参数
        Numeric Length2(6);                                                                //短周期区间参数
        Numeric IPS(4);                                                                                //保护止损波动率参数
        Numeric AtrVal(10);                                                                        //波动率参数
Vars
        NumericSeries ProtectStopL;
        NumericSeries ATR;
        NumericSeries Upperband;
        NumericSeries Lowerband;
        NumericSeries Exitlong;
        NumericSeries Exitshort;
        Numeric L2;
        Numeric L1;
        Numeric Minpoint;
Begin

        // 集合竞价
        If(BarStatus == 2 And IsCallAuctionTime) Return;
       
        Minpoint = Minmove*PriceScale;
    ATR = AvgTrueRange(AtrVal);                                                     //定义ATR
        L1 = Max(Length1,Length2);                                                     //出场周期选择较大的区间参数
        L2 = Min(Length1,Length2);                                                     //出场周期选择较小的区间参数
        Upperband = Highest(High, L1);                                             //长周期最高价区间
        Lowerband = lowest(Low,L1);                                                       //长周期最低价区间
        Exitlong = Lowest(Low,L2);                                                     //短周期最低价区间
        Exitshort = Highest(high,L2);                                             //短周期最高价区间
       
        //系统入场
        If(Marketposition == 0 and High >= Upperband[1] + Minpoint And Vol > 0)             //价格大于长周期最高价区间入场做多
        {
                Buy(0, Max(Open, Upperband[1] + Minpoint));
                ProtectStopL = Entryprice - IPS*ATR[1];
        }
       
        //系统出场
        If(MarketPosition == 1 and BarsSinceEntry >0 And Vol > 0)
        {
                If( Low <= ProtectStopL[1] and ProtectStopL[1] >= Exitlong[1])  //价格低于入场价以下一定ATR幅度止损
                {
                        Sell (0,Min(Open,ProtectStopL[1]));
                }
                Else if (Low <= Exitlong[1] - Minpoint)                    //价格低于短周期最低价区间出场
                {
                        Sell(0, Min( Open, Exitlong[1] - Minpoint));
                }
        }

End

Rank: 1

精华
0
UID
253414
积分
7
帖子
6
主题
1
阅读权限
10
注册时间
2017-7-4
最后登录
2017-8-15
2#
发表于 2017-7-21 13:24:31 |只看该作者

使用道具 举报

Rank: 2

精华
0
UID
25686
积分
83
帖子
17
主题
2
阅读权限
30
注册时间
2011-2-12
最后登录
2021-4-25
3#
发表于 2017-7-22 14:03:15 |只看该作者
这个简单啊。。

使用道具 举报

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

bottom

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

GMT+8, 2024-5-11 22:25

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部