下载MetaTrader 5

ea不下单

要添加评论,请登录注册
ookkfeng
7
ookkfeng  
 extern double lots = 0.01; // single volume
extern int stoploss = 10; // Stop
extern int takeprofit = 10; // Take Profit




extern int fastemaperiod = 12; // Express EMA
extern int slowemaperiod = 26; // EMA slow lane
extern int signalperiod = 21; // signal line SMA
extern double signaldifference = 0.0002; // start from zero axial differential
extern int slippage = 5; // allow slippage
int start ()
{
if (OrdersTotal () == 0)
{
if (myOsma () == 1 && myOrderHistory () == 1)
OrderSend (Symbol (), 0, lots, Ask, slippage, stoploss, takeprofit, "state", 379275,0, Red);
if (myOsma () == 2 && myOrderHistory () == 2)
OrderSend (Symbol (), 1, lots, Bid, slippage, stoploss, takeprofit, "state", 379275,0, Red);
}
return (0);
}



int myOsma ()
{
int mysignal1 = 0;
double myOsma1 = iOsMA (Symbol (), 0, fastemaperiod, slowemaperiod, signalperiod, PRICE_OPEN, 0);
double myOsma2 = iOsMA (Symbol (), 0, fastemaperiod, slowemaperiod, signalperiod, PRICE_OPEN, 1);
double myOsma3 = iOsMA (Symbol (), 0, fastemaperiod, slowemaperiod, signalperiod, PRICE_OPEN, 2);
if ((myOsma3-0.00)> signaldifference && myOsma3 <myOsma2 && myOsma2 <myOsma1) mysignal1 = 1;
if ((0.00-myOsma3)> signaldifference && myOsma3> myOsma2 && myOsma2> myOsma1) mysignal1 = 2;
return (mysignal1);
}
int myOrderHistory ()
{
int mysignal2 = 0;
if (OrderSelect (OrdersHistoryTotal () - 1, SELECT_BY_POS, MODE_HISTORY))
{
if (OrdersHistoryTotal () == 0) mysignal2 = 1;
if (OrderType () == OP_BUY) mysignal2 = 2;
if (OrderType () == OP_SELL) mysignal2 = 1;
}
return (mysignal2);
} 

shazi2002
6
shazi2002  
if (OrdersTotal () == 0)
{
if (myOsma () == 1 && myOrderHistory () == 1)
OrderSend (Symbol (), 0, lots, Ask, slippage, stoploss, takeprofit, "state", 379275,0, Red);
if (myOsma () == 2 && myOrderHistory () == 2)
OrderSend (Symbol (), 1, lots, Bid, slippage, stoploss, takeprofit, "state", 379275,0, Red);
改进
if (myOsma () == 1 && myOrderHistory () == 1){
stoploss = Ask - stoploss * Point * 10;
takeprofit = Ask + takeprofit * Point * 10;
OrderSend (Symbol (), 0, lots, Ask, slippage, stoploss, takeprofit, "state", 379275,0, Red);
}

要添加评论,请登录注册