系统交易论坛 - 开拓者期货自动交易平台's Archiver

mmc29170 发表于 2010-7-30 10:46

给大家一个双均线交易模型

给大家一个双均线交易模型,欢迎大家试用指教
//------------------------------------------------------------------------
// 简称: 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公式修改和重写的权利
//------------------------------------------------------------------------

mmc29170 发表于 2010-7-30 10:48

参数自己试

chitin 发表于 2011-12-2 17:37

您好!能否帮我做一个发给我,好吗?联系QQ:67929988或邮箱[email]chitin@sina.com[/email],非常感谢您!

lj_0002 发表于 2011-12-18 22:34

TotalEquity = CurrentCapital()+ Abs(CurrentContracts()*Close*ContractUnit()*BigPointValue()*MarginRatio());
里面的CurrentCapital()函数没有被声明。。。。

nangua20003 发表于 2011-12-18 22:52

好难啊,都看不懂

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.