- 精华
- 0
- 在线时间
- 320 小时
- UID
- 188
- 积分
- 597
- 帖子
- 91
- 阅读权限
- 50
- 注册时间
- 2007-8-24
- 最后登录
- 2019-4-5
- 精华
- 0
- UID
- 188
- 积分
- 597
- 帖子
- 91
- 主题
- 27
- 阅读权限
- 50
- 注册时间
- 2007-8-24
- 最后登录
- 2019-4-5
|
//------------------------------------------------------------------------
// 简称: sd
// 名称: sd
// 类别: 交易指令
// 类型: 多头建仓
// 输出:
//------------------------------------------------------------------------
Vars
Numeric lots(8);
Bool szwy;
Bool ssly;
Bool sly;
Bool sszwy;
Begin
if (BarStatus == 2 )
{Lots=A_FreeMargin /(Q_AskPrice*ContractUnit*MarginRatio);
Lots= IntPart(Lots); }// 取整
Else If(BarStatus<>2 )
{Lots=CurrentCapital/(Close*ContractUnit*MarginRatio);
Lots=IntPart(Lots); // 取整
}
SZWY=(close<open)&&(close[1]<=open[1])&&(close[2]<=open[2]);
SSLY=(CLOSE>OPEN)&&(CLOSE[1]>=OPEN[1])&&(CLOSE[2]>=OPEN[2])&&(CLOSE[3]>=OPEN[3]);
SLY=(CLOSE>OPEN )&&(CLOSE[1]>=OPEN[1])&&(CLOSE[2]>=OPEN[2]);
SSZWY=(CLOSE<OPEN)&&(CLOSE[1]<=OPEN[1])&&(CLOSE[2]<=OPEN[2])&&(CLOSE[3]<=Open[3]);
// 开多条件
IF(ssly and Time<0.144500 ) // 在四连阳形态的时候!在下根K线开盘价做多
Buy(lots,Close,True);
// 开空条件
if(sszwy and Time<0.144500 ) //在四连阴形态的时候!在下根K线开盘价卖空
SellShort(lots,Close,True);
if(szwy )
Sell(lots,Close,True);
if(sly)
BuyToCover(lots,Close,True);
end
//------------------------------------------------------------------------
// 编译版本 GS2004.06.12
// 用户版本 2007/09/18 21:05
// 版权所有 dw53692
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------
这个代码没有问题!但为什么在图表上却没有显示开仓和平仓呢!
[ 本帖最后由 dengwenle 于 2007-9-18 21:10 编辑 ] |
|