//+------------------------------------------------------------------+ //| MACDT.mq4 | //+------------------------------------------------------------------+ #property copyright "Maloma" #include <stdlib.mqh> extern double Lot = 0.1; extern double Take = 1; extern double SL = 20; double M00,M01,M10,M11,M20,M21; int Magic=986234856; int start(){ M00=iCustom(Symbol(),0,"MACDTrad",0,0); M01=iCustom(Symbol(),0,"MACDTrad",0,1); M10=iCustom(Symbol(),0,"MACDTrad",1,0); M11=iCustom(Symbol(),0,"MACDTrad",1,1); M20=iCustom(Symbol(),0,"MACDTrad",2,0); M21=iCustom(Symbol(),0,"MACDTrad",2,1); RefreshRates(); if(OrdersTotal()<1) { if(M00>M01 && M10>M11 && M20>M21) OrderSend(Symbol(),OP_BUY,Lot,Ask,2,Ask-SL*Point,0,NULL,Magic,0,CLR_NONE); if(M00<M01 && M10<M11 && M20<M21) OrderSend(Symbol(),OP_SELL,Lot,Bid,2,Bid+SL*Point,0,NULL,Magic,0,CLR_NONE); } int c1=OrdersTotal(); for(int c2=c1;c2>=0;c2--) { OrderSelect(c2,SELECT_BY_POS,MODE_TRADES); if(OrderProfit()>Take) { if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,2,CLR_NONE); if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,2,CLR_NONE); } } return (0); }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
MACDTrad
Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached
It Closes Orders by itself
Other Features: