[MT4-EA]请高手帮我改下Ea,策略测试没有反映,我错在哪里?
#property copyright "DAVID LEE"
#property description "ZHPUYI"
#include
#include
#property strict
//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Yellow
#property indicator_color5 White
//--- input parameters
extern int APeriod=256;
extern int BPeriod=256;
extern int Drangon=256;
input int Rime=256;
input int Boiling=1000;
input int Flow=262; //预期
input int Drive=131; //预期
input int Horse=1; //趋势
input int Fight=300; //背向趋势止损
input int Repent=372; //主要趋势的止损
input double Pigs=0.01; //手数
input int Sisters=12; //开仓限制
input int Fish=30; //反弹获利
input int Thunder=3; // 滑点
// willim
input int InpJawsPeriod=13; // Jaws Period
input int InpJawsShift=8; // Jaws Shift
input int InpTeethPeriod=8; // Teeth Period
input int InpTeethShift=5; // Teeth Shift
input int InpLipsPeriod=5; // Lips Period
input int InpLipsShift=3; // Lips Shift
//--- indicator buffers
double ExtBlueBuffer;
double ExtRedBuffer;
double ExtLimeBuffer;
double ExtABuffer;
double ExtBBuffer;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit(void)
{
IndicatorDigits(Digits);
//--- line shifts when drawing
SetIndexShift(0,InpJawsShift);
SetIndexShift(1,InpTeethShift);
SetIndexShift(2,InpLipsShift);
//--- first positions skipped when drawing
SetIndexDrawBegin(0,InpJawsShift+InpJawsPeriod);
SetIndexDrawBegin(1,InpTeethShift+InpTeethPeriod);
SetIndexDrawBegin(2,InpLipsShift+InpLipsPeriod);
SetIndexDrawBegin(3,APeriod);
SetIndexDrawBegin(4,BPeriod);
//--- 5 indicator buffers mapping
SetIndexBuffer(0,ExtBlueBuffer);
SetIndexBuffer(1,ExtRedBuffer);
SetIndexBuffer(2,ExtLimeBuffer);
SetIndexBuffer(3,ExtABuffer);
SetIndexBuffer(4,ExtBBuffer);
//--- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexStyle(3,DRAW_LINE);
SetIndexStyle(4,DRAW_LINE);
//--- index labels
SetIndexLabel(0,"Gator Jaws");
SetIndexLabel(1,"Gator Teeth");
SetIndexLabel(2,"Gator Lips");
SetIndexLabel(3,"Drangon");
SetIndexLabel(4,"Rime");
}
//+------------------------------------------------------------------+
//| Bill Williams' Alligator |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time,
const double &open,
const double &high,
const double &low,
const double &close,
const long &tick_volume,
const long &volume,
const int &spread)
{
int limit=rates_total-prev_calculated;
//--- main loop
for(int i=0; i10*Point && Open[1]*0.6210*Point && Open[1]*0.62= 0; i --)
// {
// if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
// if(OrderSelect(i,SELECT_BY_POS))
// {
//---- first order is buy or sell
// if(OrderProfit()>0)
// {
// while(true)
// {
// if(OrderType()==OP_BUY) price=Bid;
// else price=Ask;
// result=OrderClose(OrderTicket(),OrderLots(),price,3,CLR_NONE);
// if(result!=TRUE) { Wait();RefreshRates();error=GetLastError(); Print("LastError = ",error); }
//else error=0;
//if(error==135) RefreshRates();
// else break;
// }
// }
// }
//else Print( "Error when order select ", GetLastError());
//----
//}
return(0);
};
//----
// 根据持仓量采取不用措施 switch 包括:减仓处理、加仓处理、修改订单或者取消订单。
发表于:2015-03-02 07:11只看该作者
2楼
爱我别走
韬客社区www.talkfx.co
发表于:2015-09-14 14:57只看该作者
3楼
等高手出現~~~
韬客社区www.talkfx.co