sovetnik[1]





//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

extern double Lots         = 0.1;   // Âåëè÷èíà ëîòà
extern int    MinProfit    = 10;    // Ïðèáûëü â ïóíêòàõ 
extern int    Step         = 0;   
extern double lStopLoss = 60;
extern double sStopLoss = 60;

double step;
int magic=3485632;
int expBars;
//+------------------------------------------------------------------+
int start(){

 int oo=0;
 double slp=99999,shp=0;
 double blp=99999,bhp=0;
 int bprofit=0,sprofit=0;
 int j=OrdersTotal()-1;
 for(int i=j;i>=0;i--){
  OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
  if(Symbol()==OrderSymbol() && magic==OrderMagicNumber() && OrderType()==OP_BUY){
   oo++;
   if(OrderOpenPrice()<blp) blp=OrderOpenPrice();
   if(OrderOpenPrice()>bhp) bhp=OrderOpenPrice();
   bprofit=bprofit+MathRound((OrderProfit()+OrderSwap())/MarketInfo(Symbol(),MODE_TICKVALUE)/MarketInfo(Symbol(),MODE_MINLOT));
  }
  if(Symbol()==OrderSymbol() && magic==OrderMagicNumber() && OrderType()==OP_SELL){
   oo++;
   if(OrderOpenPrice()<slp) slp=OrderOpenPrice();
   if(OrderOpenPrice()>shp) shp=OrderOpenPrice();
   sprofit=sprofit+MathRound((OrderProfit()+OrderSwap())/MarketInfo(Symbol(),MODE_TICKVALUE)/MarketInfo(Symbol(),MODE_MINLOT));
  }
 }
 
 Comment("Áàé Ïðîôèò=", bprofit," blp=", blp," bhp=",bhp," blp-step=",blp-step," bhp+step=",bhp+step,
         "\nÑåë Ïðîôèò=", sprofit," slp=", slp," shp=",shp," slp-step=",slp-step," shp+step=",shp+step);
 
 if(oo==0){
  RefreshRates();
  OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"pio_pir_buy",magic,0,Blue);
  OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"pio_pir_sell",magic,0,Magenta);
 }
 
 if(bprofit>=MinProfit){
  j=OrdersTotal()-1;
  for(i=j;i>=0;i--){
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   RefreshRates();
   if(Symbol()==OrderSymbol() && magic==OrderMagicNumber() && OrderType()==OP_BUY)
    OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue);
  }
 }

 if(sprofit>=MinProfit){
  j=OrdersTotal()-1;
  for(i=j;i>=0;i--){
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   RefreshRates();
   if(Symbol()==OrderSymbol() && magic==OrderMagicNumber() && OrderType()==OP_SELL)
    OrderClose(OrderTicket(),OrderLots(),Ask,3,Magenta);
  }
 }

 RefreshRates();
 if (Step==0) {step=(Ask-Bid)*2;} else {step=Step*Point;}
 
 RefreshRates();
 if(blp-step>=Bid && isNewBar())
  OrderSend(Symbol(),OP_BUY,Lots,Ask,3,GetStopLossBuy(),0,"pio_pir_buy",magic,0,Blue);
// if(bhp+step<=Bid)
//  OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"pio_pir_buy",magic,0,Blue);
// if(slp-step>=Ask)
//  OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"pio_pir_sell",magic,0,Magenta);
 if(shp+step<=Ask && isNewBar())
  OrderSend(Symbol(),OP_SELL,Lots,Bid,3,GetStopLossSell(),0,"pio_pir_sell",magic,0,Magenta);

   
 return(0);
}

double GetStopLossBuy() { 	return (Bid-lStopLoss*Point);} 
double GetStopLossSell() { 	return(Ask+sStopLoss*Point); } 
bool isNewBar()
  {
   bool res=false; 
   if (expBars!=Bars) 
      {
      expBars=Bars;
      res=true;
      } 
   return(res);
  }



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

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:

BackTest : EURUSD on H1

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

BackTest : EURUSD on H1

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

BackTest : EURUSD on H1

From 2010-03-01 to 2010-03-27 Profit Factor:0.96 Total Net Profit:-55.52

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:1.77 Total Net Profit:2392.32

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-04-16 Profit Factor:0.04 Total Net Profit:-10013.22

BackTest : USDCAD on H1

From 2009-01-01 to 2010-01-01 Profit Factor:0.39 Total Net Profit:-9996.10

BackTest : USDCAD on H1

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

BackTest : USDCHF on H1

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

Request Backtest for sovetnik[1]


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

Pair: Period: