Questions from Beginners MQL4 MT4 MetaTrader 4 - page 188

 

Good people, can you give us some advice? When testing an EA, trades don't open in log error 3: Wrong parameters. What have I done wrong with the custom functions?

              ticket=OrderSend(Symbol(),OP_SELLSTOP,Lots,Prices_install(),3,0,0,NULL,MAGICNUMBER,0,clrGreen);
               if(ticket>0)//проверка открытия позиции
                 {
                  if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
                     Print("SELL ордер открыт:",OrderOpenPrice());
                 }
               else
                  Print("Ошибка открытия ордера SELL:",GetLastError());
              }
            return;
           }
        }

      //+---------------------------------------------------------------------------+
      //|                     Условия модификации ордеров                           |
      //+---------------------------------------------------------------------------+

      if(ticket>0)
        {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
           {
            //--- длинная позиция открыта
            switch(OrderType())
              {
               case OP_BUYSTOP:
                  if(NormalizeDouble(OrderOpenPrice()-Prices_install(),Digits)>0 && NormalizeDouble(Prices_install()-Bid,Digits)>0)
                    {
                     if(OrderModify(ticket,Prices_install(),0,0,0,clrBlue))
                        Print("Цена Price_BUY ордера успешно модифицирована.");
                     else
                        Print("Ошибка модификации ордера BUYStop. Код ошибки=",GetLastError());
                    }
                  else
                     Print("Цена модификации выше цены ордера");
                  break;
               case OP_SELLSTOP:
                  if(NormalizeDouble(Prices_install()-OrderOpenPrice(),Digits)>0 && NormalizeDouble(Ask-Prices_install(),Digits)>0)
                    {
                     if(OrderModify(ticket,Prices_install(),0,0,0,clrGreen))
                        Print("Цена Price_SELL ордера успешно модифицирована.");
                     else
                        Print("Ошибка модификации ордера SELLStop. Код ошибки=",GetLastError());
                    }
                  else
                     Print("Цена модификации выше цены ордера");
                  break;
               case OP_BUY:
                  if(NormalizeDouble(StopLosse_install()-OrderStopLoss(),Digits)>0 && NormalizeDouble(Ask-StopLosse_install(),Digits)>0)
                    {
                     if(OrderModify(ticket,OrderOpenPrice(),StopLosse_install(),0,0,clrBlue))
                        Print("Цена Price_BUY ордера успешно модифицирована.");
                     else
                        Print("Ошибка модификации ордера BUY. Код ошибки=",GetLastError());
                    }
                  else
                     Print("Цена модификации выше цены ордера");
                  break;
               case OP_SELL:
                  if(NormalizeDouble(OrderStopLoss()-StopLosse_install(),Digits)>0 && NormalizeDouble(StopLosse_install()-Bid,Digits)>0)
                    {
                     if(OrderModify(ticket,OrderOpenPrice(),StopLosse_install(),0,0,clrGreen))
                        Print("Цена Price_SELL ордера успешно модифицирована.");
                     else
                        Print("Ошибка модификации ордера SELL. Код ошибки=",GetLastError());
                    }
                  else
                     Print("Цена модификации выше цены ордера");
                  break;
              }
           }
        }
      Sleep(5);
     }
   return;
  }
//+------------------------------------------------------------------+
double StopLosse_install()
  {
   double StopLoss=iSAR(NULL,PERIODs_short_term,Step,Maximum,1);
   double StopLoss_install;
   int StopLevel=(int)MarketInfo(Symbol(),MODE_STOPLEVEL); // Минимально допустимый уровень стоп-лосса/тейк-профита в пунктах
   int FreezeLevel=(int)MarketInfo(Symbol(),MODE_FREEZELEVEL);//Уровень заморозки ордеров в пунктах
   switch(OrderType())
     {
      case 0:
         if(Bid-StopLoss>FreezeLevel)
           {
            if(Bid-StopLoss>=StopLevel)
               StopLoss_install=NormalizeDouble(StopLoss,Digits);
            if(Bid-StopLoss<StopLevel)
               StopLoss_install=NormalizeDouble(StopLoss-StopLevel*MarketInfo(Symbol(),MODE_DIGITS),Digits);
           }
         else
            Print("Цена открытия ордера находится в дистанции заморозки:",GetLastError());
         break;
      case 1:
         if(StopLoss-Ask>FreezeLevel)
           {
            if(StopLoss-Ask>=StopLevel)
               StopLoss_install=NormalizeDouble(StopLoss,Digits);
            if(StopLoss-Ask<StopLevel)
               StopLoss_install=NormalizeDouble(StopLoss+StopLevel*MarketInfo(Symbol(),MODE_DIGITS),Digits);
           }
         else
            Print("Цена открытия ордера находится в дистанции заморозки:",GetLastError());
         break;
     }
     return(StopLoss_install);
  }
//+------------------------------------------------------------------+
double Prices_install()
  {
   double Price=iSAR(NULL,PERIODs_short_term,Step,Maximum,1);
   double Price_install;
   int StopLevel=(int)MarketInfo(Symbol(),MODE_STOPLEVEL); // Минимально допустимый уровень стоп-лосса/тейк-профита в пунктах
   int FreezeLevel=(int)MarketInfo(Symbol(),MODE_FREEZELEVEL);//Уровень заморозки ордеров в пунктах
   switch(OrderType())
     {
      case 4:
         if(Price-Ask>FreezeLevel)
           {
            if(Price - Ask>=StopLevel)
               Price_install=NormalizeDouble(Price,Digits);
            if(Price - Ask<StopLevel)
               Price_install=NormalizeDouble(Price+StopLevel*MarketInfo(Symbol(),MODE_DIGITS),Digits);
           }
         else
            Print("Цена открытия ордера находится в дистанции заморозки:",GetLastError());
         break;
      case 5:
         if(Bid-Price>FreezeLevel)
           {
            if(Bid-Price>=StopLevel)
               Price_install=NormalizeDouble(Price,Digits);
            if(Bid-Price<StopLevel)
               Price_install=NormalizeDouble(Price+StopLevel*MarketInfo(Symbol(),MODE_DIGITS),Digits);
           }
         else
            Print("Цена открытия ордера находится в дистанции заморозки:",GetLastError());
         break;
     }
     return(Price_install);
  }
//+------------------------------------------------------------------+
 

Good afternoon help on parabolic please! I want to make logic with the Expert Advisor as shown on the picture:


I write the code like this:

ParSar_0 = iSAR(NULL, time1_method, parsar_Step, parsar_Maximum, 0);
ParSar_1 = iSAR(NULL, time1_method, parsar_Step, parsar_Maximum, 1);

     if(ParSar_0 < Bid && ParSar_1 > Bid)
     {
         TP = NormalizeDouble(Ask + takeprofit * _Point, _Digits);
         ticket = OpenOrder(_Symbol, OP_BUY, lot, Ask, slippage, 0, TP, comment, Magic, 0, clrGreen); //покупка
     }
     
     if(ParSar_0 > Bid && ParSar_1 < Bid)
     {
         TP = NormalizeDouble(Bid - takeprofit * _Point, _Digits);
         ticket = OpenOrder(_Symbol, OP_SELL, lot, Bid, slippage, 0, TP, comment, Magic, 0, clrRed); //продажа
     }
     } 


See if I've made any mistakes, because it's crashing ..... Thanks a lot!

 
What kind of deposit would I need to make a profit of $100 a day?
 
NemoomeN:
What kind of deposit should I have to make a profit of 100 dollars a day?


100 quid a day and have 0 drawdown ?

 
NemoomeN:
What kind of deposit would I need to make a profit of $100 a day?

Deposit $10! Get 1000% a day and withdraw a profit of $100 a day!

 
What are the nuances of using loops in making trading decisions by the Expert Advisor? Roughly speaking, if there are 20 levels of support/resistance, will the EA work correctly if we check all levels using for ? Or is it better to take the nearest ones and do it through if?
 
How do I open a demo account with my investor username and password on MT4?
 
Сергей Крашенинников:
How do I open a demo account with my investor username and password on MT4?

A server is still needed

 
aa
Please advise how to make it so that on mt4/5 bars would not show openings. Theonly thing it showsis the close of the bar.
 
Can you tell me how to connect the Statemnt charts? To display a graph of multicurrency trading. I've seen it somewhere for a long time, but I can't find it
Реализация мультивалютного режима в MetaTrader 5
Реализация мультивалютного режима в MetaTrader 5
  • www.mql5.com
В настоящее время мультивалютных торговых систем, индикаторов и экспертов разработано огромное количество. Тем не менее, до сих пор создатели этого "огромного количества" сталкивались со специфическими для мультивалютных систем трудностями. С выпуском в свет терминала MetaTrader 5 и языка программирования MQL5 появилась возможность  реализации...
Reason: