[MT4指标]MACD_ColorHist_Alert++LA+5
和另外一个MACD的指标配合使用的//+------------------------------------------------------------------+
//| Wpaten.mq4 |
//| Wpaten |
//| writen by Michel |
//| Daily chart |
//+------------------------------------------------------------------+
#property copyright "Wpaten"
#property link ""
extern double Lots = 1; // Lots * 2 will be opened
extern int Slippage = 0;
extern int Magic = 30130;
int i, Ticket;
double SL;
datetime YstTime = 0;
bool AllowBuy, AllowSell;
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
void start()
{
if(Close[1] < Open[1]) AllowBuy = true;
if(Close[1] > Open[1]) AllowSell = true;
for(i = OrdersTotal()-1; i >= 0; i --)
{
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if(OrderSymbol() != Symbol()) continue;
if(OrderMagicNumber() != Magic) continue;
if(OrderLots() > Lots)
{
if((OrderType() == OP_BUY && OrderClosePrice() - OrderOpenPrice() >= 30*Point) ||
(OrderType() == OP_SELL && OrderOpenPrice() - OrderClosePrice() >= 30*Point))
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,CLR_NONE);
OrderClose(OrderTicket(),Lots,OrderClosePrice(),Slippage,Yellow);
}
}
if(OrderType() == OP_BUY) AllowBuy = false;
if(OrderType() == OP_SELL) AllowSell = false;
}
if(Time[0] <= YstTime) return;
// Check for open a Buy Order
if(AllowBuy && Close[1] > Open[1] && Close[2] > Open[2] && Close[3] > Open[3])
{
SL = MathMin(Low[1]-2*Point, Ask-90*Point);
Ticket = OrderSend(Symbol(),OP_BUY, Lots*2, Ask, Slippage, SL, Ask+130*Point, "Wpaten", Magic, 0, DeepSkyBlue);
if(Ticket <= 0) return;
}
// Check for open a Sell Order
if(AllowSell && Close[1] < Open[1] && Close[2] < Open[2] && Close[3] < Open[3])
{
SL = MathMax(High[1]+2*Point, Bid+90*Point);
Ticket = OrderSend(Symbol(),OP_SELL, Lots*2, Bid, Slippage, SL, Bid-130*Point, "Wpaten", Magic, 0, DarkOrange);
if(Ticket <= 0) return;
}
YstTime = Time[0];
}
MACD_ColorHist_Alert LA 5(1).mq4
发表于:2015-06-22 00:41只看该作者
2楼
非常感谢楼主!
韬客社区www.talkfx.co