Старый прибыльный советник не работает. Помогите, добрые люди...

 

Вот код старого советника. Ни как не пойму как прикрутить к обновленному терминалу..

 

//+------------------------------------------------------------------+

//|                                                       MA_RSI.mq4 |

//|                        Copyright 2013, MetaQuotes Software Corp. |

//|                                        http://www.metaquotes.net |

//+------------------------------------------------------------------+

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property link      "http://www.metaquotes.net"


extern double TakeProfit = 200;

extern double StopLoss = 80;

extern double TrailingStop = 60;


extern int    BigMA=200;      // Период BigМА 

extern int    MA=21;      // Период МА


extern int   RSI=13;      // RSI 

extern int   RSIbuy = 30 ; // RSIbuy

extern int   RSIsell = 70 ; // RSIsell


extern double Lots = 0.5;

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

int start()

  {

   int cnt, ticket, total;


   if(Bars<100)

     {

      Print("bars less than 100");

      return(0);  

     }

   if(TakeProfit<10)

     {

      Print("TakeProfit less than 10");

      return(0);  // check TakeProfit

     }


double BigMA_0=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,0); // BigMA_0

double BigMA_1=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,1); // BigMA_1

double BigMA_2=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,2); // BigMA_2

double MA_0 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,0); // MA_0

double MA_1 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,1); // MA_1

double MA_2 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,2); // MA_2


double RSI_0 = iRSI(NULL,0, RSI, PRICE_CLOSE, 0); // RSI_0

double RSI_1 = iRSI(NULL,0, RSI, PRICE_CLOSE, 1); // RSI_1

double RSI_2 = iRSI(NULL,0, RSI, PRICE_CLOSE, 2); // RSI_2

double RSI_3 = iRSI(NULL,0, RSI, PRICE_CLOSE, 3); // RSI_3

double RSI_4 = iRSI(NULL,0, RSI, PRICE_CLOSE, 4); // RSI_4


   


   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((RSI_3 < RSIbuy && RSI_2 <= RSIbuy && RSI_1 > RSIbuy && RSI_0 > RSI_1 )&&(MA_0 > BigMA_0)) 

        {

         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),"0",0,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((RSI_3 > RSIsell && RSI_2 >= RSIsell && RSI_1 < RSIsell && RSI_0 < RSI_1)&&(MA_0 < BigMA_0)) 

        {

         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(StopLoss*Point),Bid-(TakeProfit*Point),"0",0,0,Red);

         if(ticket>0)

           {

            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());

           }

         else Print("Error opening SELL order : ",GetLastError()); 

         return(0); 

        }

      return(0);

     }

   // it is important to enter the market correctly, 

   // but it is more important to exit it correctly...   

   for(cnt=0;cnt<total;cnt++)

     {

      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

      if(OrderType()<=OP_SELL &&   // check for opened position 

         OrderSymbol()==Symbol())  // check for symbol

        {

         if(OrderType()==OP_BUY)   // long position is opened

           {

            // should it be closed?

            if(RSI_0 < 0)//(Close[1]<fasterEMAnow)

                {

                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position

                 return(0); // exit

                }

            // check for trailing stop

            if(TrailingStop>0)  

              {                 

               if(Bid-OrderOpenPrice()>Point*TrailingStop)

                 {

                  if(OrderStopLoss()<Bid-Point*TrailingStop)

                    {

                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);

                     return(0);

                    }

                 }

              }

           }

         else // go to short position

           {

            // should it be closed?

            if(RSI_0 > 100)//(Close[1]>fasterEMAnow)

              {

               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position

               return(0); // exit

              }

            // check for trailing stop

            if(TrailingStop>0)  

              {                 

               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))

                 {

                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))

                    {

                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);

                     return(0);

                    }

                 }

              }

           }

        }

     }

   return(0);

  }

// the end.   

Торговая платформа MetaTrader 4 для торговли на валютном рынке Форекс / MetaQuotes Software Corp.
  • www.metaquotes.net
Торговая платформа MetaTrader 4 это программный комплекс для организации брокерского обслуживания на валютном рынке Форекс. Он отвечает всем потребностям брокерской компании и является самым популярным в мире программным обеспечением для торговли на валютном рынке Форекс
 
ShakoMiko:

Вот код старого советника. Ни как не пойму как прикрутить к обновленному терминалу..

...

Если не хотите изучать MQL5, то тогда обратитесь в сервис Фриланс.
 
ShakoMiko:

Вот код старого советника. Ни как не пойму как прикрутить к обновленному терминалу..

 

//+------------------------------------------------------------------+

//|                                                       MA_RSI.mq4 |

//|                        Copyright 2013, MetaQuotes Software Corp. |

//|                                        http://www.metaquotes.net |

//+------------------------------------------------------------------+

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property link      "http://www.metaquotes.net"


extern double TakeProfit = 200;

extern double StopLoss = 80;

extern double TrailingStop = 60;


extern int    BigMA=200;      // Период BigМА 

extern int    MA=21;      // Период МА


extern int   RSI=13;      // RSI 

extern int   RSIbuy = 30 ; // RSIbuy

extern int   RSIsell = 70 ; // RSIsell


extern double Lots = 0.5;

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

int start()

  {

   int cnt, ticket, total;


   if(Bars<100)

     {

      Print("bars less than 100");

      return(0);  

     }

   if(TakeProfit<10)

     {

      Print("TakeProfit less than 10");

      return(0);  // check TakeProfit

     }


double BigMA_0=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,0); // BigMA_0

double BigMA_1=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,1); // BigMA_1

double BigMA_2=iMA(NULL,0,BigMA,0,MODE_SMA,PRICE_CLOSE,2); // BigMA_2

double MA_0 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,0); // MA_0

double MA_1 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,1); // MA_1

double MA_2 = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,2); // MA_2


double RSI_0 = iRSI(NULL,0, RSI, PRICE_CLOSE, 0); // RSI_0

double RSI_1 = iRSI(NULL,0, RSI, PRICE_CLOSE, 1); // RSI_1

double RSI_2 = iRSI(NULL,0, RSI, PRICE_CLOSE, 2); // RSI_2

double RSI_3 = iRSI(NULL,0, RSI, PRICE_CLOSE, 3); // RSI_3

double RSI_4 = iRSI(NULL,0, RSI, PRICE_CLOSE, 4); // RSI_4


   


   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((RSI_3 < RSIbuy && RSI_2 <= RSIbuy && RSI_1 > RSIbuy && RSI_0 > RSI_1 )&&(MA_0 > BigMA_0)) 

        {

         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),"0",0,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((RSI_3 > RSIsell && RSI_2 >= RSIsell && RSI_1 < RSIsell && RSI_0 < RSI_1)&&(MA_0 < BigMA_0)) 

        {

         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(StopLoss*Point),Bid-(TakeProfit*Point),"0",0,0,Red);

         if(ticket>0)

           {

            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());

           }

         else Print("Error opening SELL order : ",GetLastError()); 

         return(0); 

        }

      return(0);

     }

   // it is important to enter the market correctly, 

   // but it is more important to exit it correctly...   

   for(cnt=0;cnt<total;cnt++)

     {

      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

      if(OrderType()<=OP_SELL &&   // check for opened position 

         OrderSymbol()==Symbol())  // check for symbol

        {

         if(OrderType()==OP_BUY)   // long position is opened

           {

            // should it be closed?

            if(RSI_0 < 0)//(Close[1]<fasterEMAnow)

                {

                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position

                 return(0); // exit

                }

            // check for trailing stop

            if(TrailingStop>0)  

              {                 

               if(Bid-OrderOpenPrice()>Point*TrailingStop)

                 {

                  if(OrderStopLoss()<Bid-Point*TrailingStop)

                    {

                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);

                     return(0);

                    }

                 }

              }

           }

         else // go to short position

           {

            // should it be closed?

            if(RSI_0 > 100)//(Close[1]>fasterEMAnow)

              {

               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position

               return(0); // exit

              }

            // check for trailing stop

            if(TrailingStop>0)  

              {                 

               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))

                 {

                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))

                    {

                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);

                     return(0);

                    }

                 }

              }

           }

        }

     }

   return(0);

  }

// the end.   

Копирнул Ваш код в обновлённый mt4 всё работает??! Что конкретно у Вас не работает?