您需要 登录 才可以下载或查看,没有帐号?注册
如何表达最新的现价到两均线交叉后的距离点值,就是B点-A点的差值
本人尝试利用均线编写EA,用MA5和MA45均线的金叉或死叉决定买卖点,寻求解决的问题是:(如下图)当两均线死叉后即时现价Bid距离A点的差值是多少,如何表达B点-A点的差值?以下是编写的EA,很简单,暂且不论测试结果,只为寻求解决困惑不解之难点。小弟有请:bull,各位版主编程高手解决,不胜感激!!!
MA均线-EA.mq4 (5.48 KB, 下载次数: 6) 2010-5-12 18:50 上传
点击文件名下载附件
下载积分: 金币 -2
以下是小弟均线EA的源码,有请牛版和各位编程好手帮忙解决,谢谢各位!!!
extern double Lots = 0.1;
extern bool TakeProfitMode = True;
extern double TakeProfit = 15;
extern bool StopLossMode = True;
extern double StopLoss =250;
extern int timeframe = 0;
//+------------------------------------------------------------------+
//| ---- 系统变量 |
//+------------------------------------------------------------------+
extern double MaximumRisk = 0.15;
extern double DecreaseFactor =3;
extern int Slippage = 3;
extern int MagicNumber = 0;
//------------------------------------------------------------------+
//| expert initialization function //初始化 |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function //反初始化 |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{//A
double MA5_0_M15,MA5_1_M15,MA5_2_M15,MA5_3_M15, MA45_0_M15,MA45_1_M15,MA45_2_M15,MA45_3_M15;
double MA5_0_H4, MA5_1_H4, MA5_2_H4, MA5_3_H4, MA45_0_H4, MA45_1_H4, MA45_2_H4, MA45_3_H4;
int i,cnt, ticket, total;
if(Bars=10*Point))
{ //3
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,
Buy(# + MagicNumber + ) ,MagicNumber, 0,Yellow);
if(ticket 0)
{ //4
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) Print( BUY order opened : , OrderOpenPrice());
} //4
else Print( Error opening BUY order : , GetLastError());
return(0);
} //3
if((MA45_1_M15 MA5_1_M15) (MA45_1_M15-MA5_1_M15 =10*Point))
{ //33
ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage,Bid+ StopLoss*Point,Bid-TakeProfit*Point,
Sell(# + MagicNumber + ) , MagicNumber, 0, Blue);
if(ticket 0)
{ //44
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) Print( SELL order opened : , OrderOpenPrice());
}//44
else Print( Error opening SELL order : , GetLastError());
return(0);
} //33
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
for(cnt=0;cnt=MA45_2_M15) (MA45_1_M15 MA5_1_M15))
{ //4
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Yellow);
return(0);
} //4
} //3
} //2
else
if(OrderType()==OP_SELL)
{ //33
if((MA5_3_M15
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!