[C++] 纯文本查看 复制代码#property copyright "Napoleonmiao"
#property link "1257578383@qq.com"
#property version "1.00"
#property strict
int pA = 15;
int pB = 55;
int modeMA = 0; //MA=0, EMA=1, SMA=2;
double myLots;
double stopLoss;
datetime timeSell,timeBuy;
int OnInit()
{
myLots = 0.01;
stopLoss = 0;
timeSell=0;
timeBuy = 0;
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
}
void OnTick()
{
double MaA2 = iMA(NULL,0,pA,0,modeMA,PRICE_CLOSE,2);
double MaB2 = iMA(NULL,0,pB,0,modeMA,PRICE_CLOSE,2);
double MaA1 = iMA(NULL,0,pA,0,modeMA,PRICE_CLOSE,1);
double MaB1 = iMA(NULL,0,pB,0,modeMA,PRICE_CLOSE,1);
if(MaA2>MaB2 && MaA1MaB1 && timeBuy != Time[0]) fun_BuyScript();
else timeBuy = Time[0];
}
void fun_SellScript()
{
int i=-1;
i = OrderSend(Symbol(),OP_SELL,myLots,Bid,5,stopLoss,0,"",0,0,clrNONE);
if(i |