开拓者TB的RangeBreak交易模型源码
∙ 日内效果不如隔日来得好
Params
Numeric PercentOfRange(0.5); //突破系数
Numeric ExitOnCloseMins(14.55); //最后交易时间
Numeric MinRange(0.002); //开盘价的百分比h5源码交易平台
Numeric Lots(1); //开仓量
Vars
Numeric MyExitPrice;
Numeric DayOpen;
Numeric preDayRange;
Numeric UpperBand; //上轨
Numeric LowerBand; //下轨
Numeric MyPrice;
Params
Numeric PercentOfRange(0.5); //突破系数
Numeric ExitOnCloseMins(14.55); //最后交易时间
Numeric MinRange(0.002); //开盘价的百分比h5源码交易平台
Numeric Lots(1); //开仓量
Vars
Numeric MyExitPrice;
Numeric DayOpen;
Numeric preDayRange;
Numeric UpperBand; //上轨
Numeric LowerBand; //下轨
Numeric MyPrice;
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);
PlotNumeric("LowerBand",LowerBand);
If(MarketPosition!=1 && High>=UpperBand && Time<ExitOnCloseMins/100) //开多条件 价格高于上轨,时间小于0.145500
{
MyPrice = Max(UpperBand,Open);
Buy(Lots,MyPrice);
Return;
}
If(MarketPosition!=-1 && Low<=LowerBand &&Time<ExitOnCloseMins/100)
{
MyPrice = Min(LowerBand,Open);
SellShort(Lots,MyPrice);
Return;
}
MyPrice = Max(UpperBand,Open);
Buy(Lots,MyPrice);
Return;
}
If(MarketPosition!=-1 && Low<=LowerBand &&Time<ExitOnCloseMins/100)
{
MyPrice = Min(LowerBand,Open);
SellShort(Lots,MyPrice);
Return;
}
If( MarketPosition==1 && Low<LowerBand) //多头中如果下破下轨止损
{
MyExitPrice=Min(Open,LowerBand);
Sell(Lots,MyExitPrice);
Return;
}
If( MarketPosition==-1 && High>UpperBand) //空头中如果上穿上轨止损
{
MyExitPrice=Max(Open,UpperBand);
BuytoCover(Lots,MyExitPrice);
Return;
}
End
{
MyExitPrice=Min(Open,LowerBand);
Sell(Lots,MyExitPrice);
Return;
}
If( MarketPosition==-1 && High>UpperBand) //空头中如果上穿上轨止损
{
MyExitPrice=Max(Open,UpperBand);
BuytoCover(Lots,MyExitPrice);
Return;
}
End
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论