- 精华
- 0
- 在线时间
- 20 小时
- UID
- 14443
- 积分
- 107
- 帖子
- 22
- 阅读权限
- 30
- 注册时间
- 2010-7-16
- 最后登录
- 2012-11-8
- 精华
- 0
- UID
- 14443
- 积分
- 107
- 帖子
- 22
- 主题
- 3
- 阅读权限
- 30
- 注册时间
- 2010-7-16
- 最后登录
- 2012-11-8
|
给大家一个双均线交易模型,欢迎大家试用指教
//------------------------------------------------------------------------
// 简称: EA
// 名称: EA交易模型
// 类别: 交易指令
// 类型: 其他
// 输出: 一条指数移动均线和一条调整移动均线(适应性移动平均线)
//------------------------------------------------------------------------
Params
Numeric Length1(16);
Numeric Length2(80);
Numeric FastAvgLength(2);
Numeric SlowAvgLength(30);
Vars
NumericSeries AMA;
NumericSeries EMA;
Bool Condition1;
Bool Condition2;
Numeric TotalEquity;
Numeric UseMargin;
Numeric EntryLots;
Begin
TotalEquity = CurrentCapital()+ Abs(CurrentContracts()*Close*ContractUnit()*BigPointValue()*MarginRatio());
UseMargin = Close*ContractUnit*BigPointValue*MarginRatio;
EntryLots = IntPart(TotalEquity*0.25/UseMargin);
AMA = AdaptiveMovAvg(Close,Length1,FastAvgLength,SlowAvgLength);
EMA = XAverage(Close, Length2);
if (AMA>EMA)
{
Buy(EntryLots,NextOpen,True);
}
if (EMA>AMA)
{
SellShort(EntryLots,NextOpen,True);
}
End
//------------------------------------------------------------------------
// 编译版本 GS2004.06.12
// 用户版本 2010/07/26 13:21
// 版权所有 mmc29170
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------ |
|