sistem5





//+------------------------------------------------------------------+
//|                                                   ÌîÿÑèñòåìà.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. | 
//|                                        http://www.metaquotes.net | 
//+------------------------------------------------------------------+
//---- input parameters
extern double Lots = 0.1;
extern int TakeProfit = 4;
extern int StopLoss = 100;
extern bool Trading = true;
extern string t1 = "01:59";
extern string t2 = "08:29";
extern string t3 = "15:29";
extern string t4 = "24:00";
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;
  string   s_open;
  datetime t1_open,t2_open,t3_open,t4_open,TimeOpen;
  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(!Trading) return(0);

  if(TimeOpen>=60 || TimeOpen<0) TimeOpen=0;

  TP=TakeProfit;
  if(TakeProfit<=min_stop) TP=min_stop+3;

  t1_open=0; t2_open=0; t3_open=0; t4_open=0; TimeOpen=0;
  s_open=Year()+"."+Month()+"."+Day();
  if(t1!="00:00") { t1_open=StrToTime(s_open+" "+t1); if(CurTime()>=t1_open) TimeOpen=t1_open; }
  if(t2!="00:00") { t2_open=StrToTime(s_open+" "+t2); if(CurTime()>=t2_open) TimeOpen=t2_open; }
  if(t3!="00:00") { t3_open=StrToTime(s_open+" "+t3); if(CurTime()>=t3_open) TimeOpen=t3_open; }
  if(t4!="00:00") { t4_open=StrToTime(s_open+" "+t4); if(CurTime()>=t4_open) TimeOpen=t4_open; }

  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);
    }

    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);
    }
  }

  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:

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for sistem5


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: