Нужна помощь в написании советника.

 

дело в том что запуская эксперт, он делает ставки в одну минуту около шести ставок. Еще он начинает считать с самой высшей точки, а как сделать так чтобы считал с нижней точки бара. Как с этими двумя проблемами разобраться???


//+------------------------------------------------------------------+
//| Торговая система Эверест-10. mq4|
//| Петренко Сергей Анатольевич |
//| netdaiver@narod.ru |
//+------------------------------------------------------------------+


extern double TakeProfit = 10;
extern double Lots = 0.1;
extern double TrailingStop = 25;
extern double MA=5;
extern double MAC=7;
extern double рси1;
extern double рси2;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double MA;
Lots=(MathFloor(AccountBalance()/300))/10;
int cnt, ticket, total;
// initial data checks
// it is important to make sure that the expert works with a normal
// chart and the user did not make any mistakes setting external
// variables (Lots, StopLoss, TakeProfit,
// TrailingStop) in our case, we check TakeProfit
// on a chart of less than 100 bars
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // check TakeProfit
}
// to simplify the coding and speed up access
// data are put into internal variables
MA=iWPR(NULL,0,60,0);
рси1=iRSI(NULL,0,3,PRICE_LOW,0);
рси2=iRSI(NULL,0,3,PRICE_HIGH,0);
total=OrdersTotal();
if(total<1)
{
// no opened orders identified
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
// check for long position (BUY) possibility
if(MA<-97.9&&рси1<18)
{
ticket=OrderSend(Symbol(),OP_BUY, Lots, Ask, 0,Bid- TrailingStop *Point, Ask+TakeProfit*Point, "macd sample",16384, 0, Green);
if(ticket>0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ", GetLastError());
return(0);
}
// check for short position (SELL) possibility

if(MA>-4.1&&рси2>85)
{
ticket=OrderSend(Symbol(),OP_SELL, Lots, Bid, 0, Ask+ TrailingStop *Point, Bid-TakeProfit*Point, "macd sample",16384, 0, Green);
if(ticket>0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ", GetLastError());
return(0);
}
// check for short position (SELL) possibility

// it is important to enter the market correctly,
// but it is more important to exit it correctly...

}
return(0);
}
// the end.

 
//+------------------------------------------------------------------+
//|                                   Торговая система Эверест-10.mq4|
//|                                      Петренко Сергей Анатольевич |
//|                                               netdaiver@narod.ru |
//+------------------------------------------------------------------+
 
 
extern double TakeProfit = 10;
extern double Lots = 0.1;
extern double TrailingStop = 25;
extern double MA=5;
extern double MAC=7;
extern double рси1;
extern double рси2;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double MA;
   Lots=(MathFloor(AccountBalance()/300))/10; 
   int cnt, ticket, total;
// initial data checks
// it is important to make sure that the expert works with a normal
// chart and the user did not make any mistakes setting external 
// variables (Lots, StopLoss, TakeProfit, 
// TrailingStop) in our case, we check TakeProfit
// on a chart of less than 100 bars
   if(Bars<100)
     {
      Print("bars less than 100");
      return(0);  
     }
   if(TakeProfit<8)
     {
      Print("TakeProfit less than 10");
      return(0);  // check TakeProfit
     }
// to simplify the coding and speed up access
// data are put into internal variables
   MA=iWPR(NULL,0,60,0);
   рси1=iRSI(NULL,0,3,PRICE_LOW,0);
   рси2=iRSI(NULL,0,3,PRICE_HIGH,0);
   total=OrdersTotal();
   static int lt;
   if(total<1 && lt!=Time[0]) 
     {
      // no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }
      // check for long position (BUY) possibility
      if(MA<-97.9&&рси1<18)//!!!
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Bid- TrailingStop *Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)){
               Print("BUY order opened : ",OrderOpenPrice());
               lt=Time[0];
            }
           }
         else Print("Error opening BUY order : ",GetLastError()); 
         return(0); 
        }
      // check for short position (SELL) possibility
    
      if(MA>-4.1&&рси2>85)//!!!
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,0,Ask+ TrailingStop *Point,Bid-TakeProfit*Point,"macd sample",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) {
               Print("BUY order opened : ",OrderOpenPrice());
               lt=Time[0];
            }
           }
         else Print("Error opening BUY order : ",GetLastError()); 
         return(0); 
        }
      // check for short position (SELL) possibility
    
   // it is important to enter the market correctly, 
   // but it is more important to exit it correctly...   
  
     }
   return(0);
  }
// the end.
первая проблема устранена, вторую сам сделаешь. Найди два коммента //!!! и поменяй местами рси1 и рси2
 
Hovijok писал (а
спасибо большое