以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 公式模型编写问题提交 (http://222.73.7.161/bbs/list.asp?boardid=4) ---- 这样转换策略有什么问题呢~~ (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=152541) |
-- 作者:TomRidder716 -- 发布时间:2017/5/6 23:45:39 -- 这样转换策略有什么问题呢~~ ////////////////////////////
原来的TB的策略
策略说明: 基于通道突破的判断
// 系统要素: // 1. 计算50根k线最高价的区间 // 2. 计算30根k线最低价的区间 // // 入场条件: // 1.价格高于50根K线最高价的区间入场 // 出场条件: // 1. 当前价格低于30根K线最低价的区间出场 // 2. 当前价格低于入场价一定ATR波动率幅度出场 // //----------------------------------------------------------------------// Params Numeric Length1(50); //长周期区间参数 Numeric Length2(30); //短周期区间参数 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 ////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
我自己转换的PEL策略
INPUT:LENGTH1(50,1,100,5),LENGTH2(30,1,100,5),IPS(4,1,100,5),ATRVAL(10,1,100,5); IF ( HOLDING>0 AND ENTERBARS>0 AND VOL>0 ) THEN BEGIN ////////////////////////////////////////////////////
|
-- 作者:wenarm -- 发布时间:2017/5/8 8:15:42 -- 补充好需要的数据后,在回测看下、、 本地测试有信号 |