Navigation:Home > Content >

sistem4-2.mq4

Time: 2016-02-10 | Download file:sistem4-2.mq4

//+------------------------------------------------------------------+
//|                                                   МояСистема.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=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(pos1pre60-TimeOpen)
        OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TP*Point,NULL,0,0,Aqua);
    }
  }

  return(0);
}
//**************************************************************************************************

Recommend