//+------------------------------------------------------------------+ //| ÌîÿÑèñòåìà.mq4 | //| Copyright © 2005, MetaQuotes Software Corp. | ÈÑÏÎËÜÇÎÂÀÒÜ ÍÀ 15 ÌÈÍÓÒÊÀÕ //| http://www.metaquotes.net | Ñ ÝÒÈÌÈ ÏÀÐÀÌÅÒÐÀÌÈ ÍÀ EURUSD - Serg. //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //---- input parameters extern double Lots = 30.0; extern int TakeProfit = 4; extern int StopLoss = 80; extern int TimeOpen = 2; extern int p1=13; extern int p2=14; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int start() { double pos1pre,pos2cur; int cnt,ticket,total,TotalOpenOrders; int mode,TP; string apos1,apos; double pp131,pp132,pp141,pp142,pb131,pb132,pb141,pb142; string aa131,aa132,aa141,aa142,ab131,ab132,ab141,ab142,aa; int min_stop=MarketInfo(Symbol(),MODE_STOPLEVEL); pos1pre = iBullsPower(NULL, 0, p1,PRICE_WEIGHTED,3); pos2cur = iBullsPower(NULL, 0, p1,PRICE_WEIGHTED,4); // 3 4 1662 80 80 // 3 5 1058 80 60 apos1 = DoubleToStr(pos1pre*10000,2) + " "; apos1 = apos1 + " | " + DoubleToStr(pos2cur*10000,2) + " "; apos1 = apos1 + " | " + DoubleToStr((pos1pre - pos2cur)*10000,2) + " "; // áûëî 1 0 à ñòàëî 3 4 pp131 = iBullsPower(NULL, 0,p1,PRICE_WEIGHTED,3); pp132 = iBullsPower(NULL, 0,p1,PRICE_WEIGHTED,4); pp141 = iBullsPower(NULL, 0,p2,PRICE_WEIGHTED,3); pp142 = iBullsPower(NULL, 0,p2,PRICE_WEIGHTED,4); pb131 = iBearsPower(NULL, 0,p1,PRICE_WEIGHTED,3); pb132 = iBearsPower(NULL, 0,p1,PRICE_WEIGHTED,4); pb141 = iBearsPower(NULL, 0,p2,PRICE_WEIGHTED,3); pb142 = iBearsPower(NULL, 0,p2,PRICE_WEIGHTED,4); aa = " íåò "; if (pp131 > pp132 && pp132 !=0 ) {aa = " YES SELL " + DoubleToStr((pp131-pp132)*10000,2) + " ";} aa131 = "Áûêè ï13 ñèãíàë Sell = " + aa ; aa = " íåò "; if (pp131 < pp132 && pp132 < 0) {aa = " YES BUY! " + DoubleToStr((pp131-pp132)*10000,2) + " ";} aa132 = " ñèãíàë Buy = " + aa ; aa = " íåò "; if (pp141 > pp142 && pp132 !=0 ) {aa = " YES SELL " + DoubleToStr((pp141-pp142)*10000,2) + " ";} aa141 = "Áûêè ï14 ñèãíàë Sell = " + aa ; aa = " íåò "; if (pp141 < pp142 && pp142 < 0) {aa = " YES BUY! " + DoubleToStr((pp141-pp142)*10000,2) + " ";} aa142 = " ñèãíàë Buy = " + aa ; aa = " íåò "; if (pb131 > pb132 && pb132 !=0) {aa = " YES SELL " + DoubleToStr((pb131-pb132)*10000,2) + " ";} ab131 = "Ìåäâ ï13 ñèãíàë Sell = " + aa ; aa = " íåò "; if (pb131 < pb132 && pb132 < 0) {aa = " YES BUY! " + DoubleToStr((pb131-pb132)*10000,2) + " ";} ab132 = " ñèãíàë Buy = " + aa ; aa = " íåò "; if (pb141 > pb142 && pb142 !=0) { aa = " YES SELL " + DoubleToStr((pb141-pb142)*10000,2) + " ";} ab141 = "Ìåäâ ï14 ñèãíàë Sell = " + aa ; aa = " íåò "; if (pb141 < pb142 && pp142 < 0) {aa = " YES BUY! " + DoubleToStr((pb141-pb142)*10000,2) + " ";} ab142 = " ñèãíàë Buy = " + aa ; Comment(apos1,"\n",aa131,aa132,"\n",aa141,aa142,"\n",ab131,ab132,"\n",ab141,ab142,"\n"); // ñ÷èòàåì êîëâî îòêðûòûõ îðäåðîâ total=OrdersTotal(); TotalOpenOrders = 0; for(cnt=0; cnt<total; cnt++) { if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES) == true) { if (OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY || OrderType()==OP_SELL) TotalOpenOrders = TotalOpenOrders+1; if(OrderType()==OP_BUY) { if(TakeProfit<=min_stop && Bid>=OrderOpenPrice()+TakeProfit*Point) { OrderClose(OrderTicket(),OrderLots(),Bid,3); } } if(OrderType()==OP_SELL) { if(TakeProfit<=min_stop && Ask<=OrderOpenPrice()-TakeProfit*Point) { OrderClose(OrderTicket(),OrderLots(),Ask,3); } } } } } if(TimeOpen>=60 || TimeOpen<0) TimeOpen=0; TP=TakeProfit; if(TakeProfit<=min_stop) TP=min_stop+3; if(TotalOpenOrders<1) { if(pos1pre>pos2cur && pos2cur!=0) { if(TimeOpen==0) OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TP*Point,NULL,0,0,Red); else if(TimeMinute(CurTime())>60-TimeOpen) OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TP*Point,NULL,0,0,Red); } if(pos1pre<pos2cur && pos2cur<0) { if(TimeOpen==0) OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TP*Point,NULL,0,0,Aqua); else if(TimeMinute(CurTime())>60-TimeOpen) OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TP*Point,NULL,0,0,Aqua); } } return(0); } //**************************************************************************************************
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Bulls Power indicator
Bears Power indicator
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It Closes Orders by itself
It automatically opens orders when conditions are reached
Other Features: