- 精华
- 0
- 在线时间
- 82 小时
- UID
- 2108
- 积分
- 245
- 帖子
- 39
- 阅读权限
- 40
- 注册时间
- 2008-8-8
- 最后登录
- 2016-3-28
- 精华
- 0
- UID
- 2108
- 积分
- 245
- 帖子
- 39
- 主题
- 4
- 阅读权限
- 40
- 注册时间
- 2008-8-8
- 最后登录
- 2016-3-28
|
//------------------------------------------------------------------------
// 简称: a1
// 名称:
// 类别: 交易指令
// 类型: 多头建仓
// 输出:
//------------------------------------------------------------------------
Params
Numeric m1(60);
Vars
Numeric lots(1);
Numeric type(0);
NumericSeries ma1(0);
Numeric rmp(0);
begin
rmp = MarketPosition;
ma1=AverageFC(close,m1);
type = ContractUnit;
if (type == 5) //以 1/3仓位开仓
lots= Trunc(CurrentCapital/Close*2*0.35,0);
Else
lots= Trunc(CurrentCapital/Close*0.35,0);
if (rmp == 0)
{
if (CrossOver(close,ma1))// 上穿60均线开仓
{
Buy(lots,High,True);
return;
}
if (Crossunder(close,ma1)) // 下穿60均线开仓
{
SellShort(lots,Low,True);
return;
}
}
if (rmp ==1)
{
If (( MaxPositionProfit/A_CurrentEquity > 0.1) And (A_BuyPosition > Ceiling(lots/2,1)+1)) //想实现赢利10%平仓一半
{
Sell(Ceiling(lots/2,1),Low);
Return;
}
If (Close <ma1)
{
Sell(0,low,True);
SellShort(lots,low,true);
Return;
}
}
if (rmp ==-1)
{
If (( MaxPositionProfit/A_CurrentEquity > 0.1) And (A_SellPosition > Ceiling(lots/2,1)+1)) //
{
BuyToCover(Ceiling(lots/2,1),Low);
Return;
}
If (Close >ma1)
{
BuyToCover(0,low,True);
Buy(lots,low,true);
Return;
}
}
End
//------------------------------------------------------------------------
// 编译版本 GS2004.06.12
// 用户版本 2008/10/11 14:52
// 版权所有 bigfrog
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------
进出场都简单的
就是当中实现平半仓的功能没办法实现
请管理员帮忙看一下
这里平半仓怎么写?
[ 本帖最后由 bigfrog 于 2008-10-14 13:37 编辑 ] |
|