- 精华
- 0
- 在线时间
- 13 小时
- UID
- 177429
- 积分
- 13
- 帖子
- 7
- 阅读权限
- 10
- 注册时间
- 2013-12-13
- 最后登录
- 2018-3-22
- 精华
- 0
- UID
- 177429
- 积分
- 13
- 帖子
- 7
- 主题
- 5
- 阅读权限
- 10
- 注册时间
- 2013-12-13
- 最后登录
- 2018-3-22
|
发表于 2018-3-22 14:36:21
|显示全部楼层
// 简称: DualThrust
// 名称: 首创版5分钟
// 类别: 公式应用
// 类型: 用户应用
// 输出: Void
//------------------------------------------------------------------------
Params
Numeric K1(0.5);
Numeric K2(0.5);
Numeric Mday(1);
Numeric Nday(1);
Numeric Lots(1);
Numeric offset(0);
Vars
Numeric BuyRange(0);
Numeric SellRange(0);
Numeric BuyTrig(0);
Numeric SellTrig(0);
Numeric HH;
Numeric LL;
Numeric HC;
Numeric LC;
Numeric i_offset;
Numeric BuyPosition;
Numeric SellPosition;
Begin
If(CurrentBar > 44*Max(Mday,Nday))//使用的是5分钟周期,其它的周期自己做相应修改
{
i_offset = offset*MinMove*PriceScale;
HH = Highest(HighD(1),Mday);
HC = Highest(CloseD(1),Mday);
LL = Lowest(LowD(1),Mday);
LC = Lowest(CloseD(1),Mday);
If((HH - LC) >= (HC - LL))
{
SellRange = HH - LC;
}
Else
{
SellRange = HC - LL;
}
HH = Highest(HighD(1),Nday);
HC = Highest(CloseD(1),Nday);
LL = Lowest(LowD(1),Nday);
LC = Lowest(CloseD(1),Nday);
If((HH - LC) >= (HC - LL))
{
BuyRange = HH - LC;
}
Else
{
BuyRange = HC - LL;
}
BuyTrig = K1*BuyRange;
SellTrig = K2*SellRange;
BuyPosition = OpenD(0)+BuyTrig;
SellPosition = OpenD(0)-SellTrig;
PlotNumeric("BuyPosition",BuyPosition);
PlotNumeric("SellPosition",SellPosition);
If(MarketPosition==0)
{ If(High>=BuyPosition)
{ Buy(lots,Max(Open,BuyPosition)+i_offset);
Return; }
If(Low<=SellPosition)
{ SellShort(lots,Min(Open,SellPosition)-i_offset);
Return; }
}
If(MarketPosition==-1)
{
{ If(High>=BuyPosition)
{ Buy(lots,Max(Open,BuyPosition)+i_offset);
Return; }
}
If(MarketPosition==1)
{
If(Low<=SellPosition)
{ SellShort(lots,Min(Open,SellPosition)-i_offset);
Return; }
}
}
End
//------------------------------------------------------------------------
// 编译版本: 2018-03-22 142440
// 内核版本: V2.7.2.14
// 版权所有 haqh100867599
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------ |
|