开拓者TB的RangeBreak交易模型源码Word文档下载推荐.docx
《开拓者TB的RangeBreak交易模型源码Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《开拓者TB的RangeBreak交易模型源码Word文档下载推荐.docx(11页珍藏版)》请在冰点文库上搜索。
NumericUpperBand;
//上轨
NumericLowerBand;
//下轨
NumericMyPrice;
Begin
DayOpen=OpenD(0);
preDayRange=HighD
(1)-LowD
(1);
//昨日波幅
PreDayRange=Max(PreDayRange,DayOpen*MinRange);
UpperBand=DayOpen+PreDayRange*PercentOfRange;
//求出上轨
LowerBand=DayOpen-PreDayRange*PercentOfRange;
//求出下轨
PlotNumeric("
UpperBand"
UpperBand);
LowerBand"
LowerBand);
If(MarketPosition!
=1&
&
High>
=UpperBand&
Time<
ExitOnCloseMins/100)
//开多条件
价格高于上轨,时间小于0.145500
{
MyPrice=Max(UpperBand,Open);
Buy(Lots,MyPrice);
Return;
}
=-1&
Low<
=LowerBand&
Time<
ExitOnCloseMins/100)
MyPrice=Min(LowerBand,Open);
SellShort(Lots,MyPrice);
If(MarketPosition==1&
LowerBand)
//多头中如果下破下轨止损
MyExitPrice=Min(Open,LowerBand);
Sell(Lots,MyExitPrice);
Return;
If(MarketPosition==-1&
UpperBand)
//空头中如果上穿上轨止损
MyExitPrice=Max(Open,UpperBand);
BuytoCover(Lots,MyExitPrice);
End
∙TB技术人员:
本帖最后由rookies于2012-7-2111:
25编辑
隔日情况下,允许二次开仓,可以提高盈利率
NumericPercentOfRange(0.5);
NumericExitOnCloseMins(14.50);
NumericMinRange(0.002);
NumericLots
(1);
NumericStopPointUpper
(1);
NumericStopPointLower
(1);
NumericLength(12);
NumericTakeStart(0.1);
NumericTakeStop(0.5);
NumericLastTradeMins(14.00);
NumericSeriesMa;
NumericMyExitPrice;
NumericDayOpen;
NumericpreDayRange;
NumericUpperBand;
NumericLowerBand;
NumericMyPrice;
NumericStopLine;
BoolSeriesUpperStoped;
BoolSeriesLowerStoped;
NumericSeriesHigherAfterEntry;
NumericSeriesLowerAfterEntry;
StringBoolSet;
Ma=Average(Close,Length);
DayOpen=OpenD(0);
preDayRange=HighD
(1)-LowD
(1);
PreDayRange=Max(PreDayRange,DayOpen*MinRange);
Commentary("
DayOpen="
+Text(DayOpen));
preDayRange="
+Text(preDayRange));
UpperBand=DayOpen+PreDayRange*PercentOfRange;
LowerBand=DayOpen-PreDayRange*PercentOfRange;
UpperBand="
+Text(DayOpen+PreDayRange*PercentOfRange));
+Text(DayOpen-PreDayRange*PercentOfRange));
PlotNumeric("
If(Date!
=Date[1])
{
UpperStoped=True;
LowerStoped=True;
}
If(UpperStoped&
LowerStoped)
If(MarketPosition!
MyPrice=Max(UpperBand,Open);
Buy(Lots,MyPrice);
UpperStoped=False;
If(!
UpperStoped)
=HigherAfterEntry&
MyPrice=Max(HigherAfterEntry,MyPrice);
PlotString("
二次建仓"
"
);
If(LowerStoped&
MarketPosition==1&
MyPrice=Min(LowerBand,Open);
Sell(Lots,MyPrice);
LowerStoped=False;
反向建仓"
ExitOnCloseMins/100)//&
=ExitOnCloseMins/100)
SellShort(Lots,MyPrice);
LowerStoped)
=LowerAfterEntry&
MyPrice=Min(LowerAfterEntry,MyPrice);
MarketPosition==-1
BuyToCover(Lots,MyPrice);
∙TB客服:
14编辑
应学友要求
加入反向平仓和二次建仓
RU0005分测试效果如图,如果做得更细一些的话会有更好的效果
15分上效果更好一些
∙网友回复:
加入动态止盈和止损
NumericExitOnCloseMins(14.50);
NumericStopPointUpper
(1);
NumericStopPointLower
(1);
NumericLength(12);
NumericTakeStart(0.1);
NumericTakeStop(0.5);
NumericLastTradeMins(14.00);
NumericSeriesMa;
NumericStopLine;
BoolSeriesUpperStoped;
BoolSeriesLowerStoped;
NumericSeriesHigherAfterEntry;
NumericSeriesLowerAfterEntry;
StringBoolSet;
Ma=Average(Close,Length);
Commentary("
If(Date!
If(UpperStoped&
UpperStoped=False;
If(!
MyPrice=Max(HigherAfterEntry,MyPrice);
PlotString("
LowerStoped=False;
MyPrice=Min(LowerAfterEntry,MyPrice);
BuyToCover(Lots