当前位置:分析家公式网 → 股票公式 → 开拓者公式 → 一键转帖:开拓者 TB 【震荡+趋势混合策略】恒温器策略【源码】
软件名称:[B]开拓者 TB 【震荡+趋势混合策略】恒温器策略【源码】[/B]
软件类型:国产软件
运行环境:Win2000/WinXP/Win2003/WinVista
软件语言:简体中文
授权方式:共享软件
软件大小:0 Bytes
官方主页:Home Page
更新时间:2013-03-17 01:08:45
软件简介:
- 本帖最后由 sorakiraa 于 2013-1-14 09:08 编辑
【震荡+趋势混合策略】恒温器策略
by RogarZ
源码:
- Params
- Numeric bollinglengths(50);
- Numeric trendliqlength(50);
- Numeric numstddevs(2);
- Numeric swingprcnt1(0.5);
- Numeric swingprcnt2(0.75);
- Numeric atrlength(10);
- Numeric swingtrendswitch(50);
- Vars
- BoolSeries swing(False);
- NumericSeries cmival;
- NumericSeries buyeasierday(0);
- NumericSeries selleasierday(0);
- NumericSeries trendlokbuy;
- NumericSeries trendloksell;
- NumericSeries trendbuypt;
- NumericSeries trendsellpt;
- NumericSeries keyofday;
- NumericSeries ma1;
- NumericSeries midd;
- Numeric swingprotstop;
- Numeric atr;
- Numeric swingbuypt;
- Numeric swingsellpt;
- Begin
- Commentary("BarInterval= "+Text(BarInterval));
- cmival=Abs(Close[1]-Close[31])/(Highest(High[1],30)-Lowest(Low[1],30));
- trendloksell=Average(Low[1],3*240/BarInterval);
- trendlokbuy=Average(High[1],3*240/BarInterval);
- keyofday=(HighD(0)+LowD(0)+CloseD(0))/3;
- If(Date<>Date[1]){
- If(CloseD(1)>keyofday[1])
- {
- selleasierday=1;//空头日
- }Else{
- buyeasierday=1;//多头日
- }
- }
- Atr=XAverage(TrueRange,atrlength*240/BarInterval);
- If(buyeasierday==1){
- swingbuypt=OpenD(0)+swingprcnt1*atr;
- swingsellpt=OpenD(0)-swingprcnt2*atr;
- }
- If(selleasierday==1){
- swingbuypt=OpenD(0)+swingprcnt2*atr;
- swingsellpt=OpenD(0)-swingprcnt1*atr;
- }
- swingbuypt=Max(swingbuypt,trendlokbuy);
- swingsellpt=Min(swingsellpt,trendloksell);
-
- PlotNumeric("Buy",swingbuypt);
- PlotNumeric("Sell",swingsellpt);
-
- ma1=Average(Close[1],trendliqlength);//趋势均线
- midd=Average(Close[1],bollinglengths);//布林中线
- trendbuypt=midd+numstddevs*StandardDev(Close[1],bollinglengths);
- trendsellpt=midd-numstddevs*StandardDev(Close[1],bollinglengths);
-
- If(cmival<swingtrendswitch/100)
- {
- If(MarketPosition==0&&High[1]>=swingbuypt)
- //开多仓
- {
- Buy(1,Max(Open,swingbuypt));
- swing=True;
- }
- If(MarketPosition==0&&Low[1]<=swingsellpt)
- //开空仓
- {
- SellShort(1,Min(Open,swingsellpt));
- swing=True;
- }
- If(MarketPosition>0&&Low[1]<=swingsellpt)
- //多头反手
- {
- SellShort(1, Min(Open,swingsellpt));
-  
[url=http://www.70822.com/soft/sort013/sort083/down-59364.html]开拓者 TB 【震荡+趋势混合策略】恒温器策略【源码】[/url]
- Params