其实就是MT4自带的MA系统,修改了下参数….测试结果翻了五倍,虽然仍会爆仓,不过志在学习了!现有几个问题:
1,这个系统的资金管理是什么原理?为什么我设仓位是一手,会出现2.2手斟至14.9手………….
2,我测试的时间是90至今,却只成交了四单………
3,如果有达人把系统的英文提示翻译或解说一下就万分感谢了,好多地方我都不明白,只是依胡画瓜,但是我想从零开始认真学习! 侠版的教学不错,但是偶没有分………5555555555555~
//+——————————————————————+
//| Moving Average.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| /images/ |
//+——————————————————————+
#define MAGICMA 20050610
extern double Lots = 1;
extern double MaximumRisk = 0.2;
extern double DecreaseFactor = 1;
extern double MovingPeriod = 200;
extern double MovingShift = 10;
//+——————————————————————+
//| Calculate open positions |
//+——————————————————————+
int CalculateCurrentOrders(string symbol)
{
int buys=0,sells=0;
//—-
for(int i=0;i0) return(buys);
else return(-sells);
}
//+——————————————————————+
//| Calculate optimal lot size |
//+——————————————————————+
double LotsOptimized()
{
double lot=Lots;
int orders=HistoryTotal(); // history orders total
int losses=0; // number of losses orders without a break
//—- select lot size
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
//—- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
for(int i=orders-1;i>=0;i–)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print(\”Error in history!\”); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//—-
if(OrderProfit()>0) break;
if(OrderProfit()1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
//—- return lot size
if(lot1) return;
//—- get Moving Average
ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
//—- sell conditions
if(Open[1]>ma && Close[1]1) return;
//—- get Moving Average
ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
//—-
for(int i=0;ima && Close[1]
我是新手,第一个EA就翻了五倍…. 中彩了!请高手解答!
请登录之后再进行评论
登录

