Questions from Beginners MQL4 MT4 MetaTrader 4 - page 190

 
gyulnara.kosareva:
Hello, can i install an EA without mql4 file if i only have the ex file of the EA?

Yes, that's what the .ex file is for

 
Hi all.
I had MT4 app version 400.1129 installed on my android, until 29.10.2019 the app was working like clockwork. On Friday I started opening it on my phone, the splash screen flashed that I was opening a new demo account and immediately the app closed. And I ended up on the desktop. I tried dozens of times and got the same result. Took terminal off, downloaded new terminal from playlist, installed it, ran it with the same result - application crashed. I downloaded Rojo forex MT4 from the market, installed and launched it and it works like clockwork. I also downloaded the MT5 version 500.1780 from Market, installed and ran it, opened demo account, everything is working fine.
Please advise what to do if I want MT4 to work on my phone again! Please.
 

Good day all! Can you please tell me what's wrong? The Strategy Tester in the Market complains about requote -NEW_ORDER(): lot=0.20; POSITION_TYPE_BUY(EURUSD); err: 4756/Failed tosend trade request; retcode: 10004/Requote;

Where can I read more about this error and how to fix it?

 
Nikolai Konstantinov:

Hi all, Can you please tell me what's wrong? The Strategy Tester in the Market complains about requote -NEW_ORDER(): lot=0.20; POSITION_TYPE_BUY(EURUSD); err: 4756/Failed tosend trade request; retcode: 10004/Requote;

Where can I read more about this error and how to fix it?


This is not an error but a market situation.
1. update prices before sending a trade for execution.
2. Re-open after repair
3. Increase slippage
 
Vladislav Andruschenko:

It's not a mistake, it's a market situation.
1. Update prices before sending a trade for execution.
2. Re-open after repair.
3. Increase slippage

Thank you, but everything you wrote is already accounted for. Is there anything else to consider?

 

Hello! Please help!

All of a sudden MT4 started to hang. All from different brokerage companies.

When starting the terminal hangs. In Manager says in front of it "does not respond. Does not respond to anything, At the bottom of the MT panel is marked that there is no connection.

Reboot terminals, change them from different brokers, remove and reinstall, clean the data with the program Clean, switching off and switching on the computer - has not given result.

It remains to reinstall the OS, but so reluctant.

Maybe someone has had such a thing?

Any advice?

 
odyn:

Remains to reinstall OS, but so reluctant.

Alternatively, on a virtual machine install the OS and terminal, I installed Oracle VM VirtualBox without any problems there MT4/MT5 work

if this is a problem with the OS, you need to reinstall it.


I checked it myself. It works with MT4 and MT5 without any problems.

 
odyn:

Hello! Please help!

All of a sudden MT4 started to hang. All from different brokerage companies.

When starting the terminal hangs. In Manager says in front of it "does not respond. Does not respond to anything, At the bottom of the MT panel is marked that there is no connection.

Reboot terminals, change them from different brokers, remove and reinstall, clean the data with the program Clean, switching off and switching on the computer - has not given result.

It remains to reinstall the OS, but so reluctant.

Maybe someone has had such a thing?

Please advise who can.

Internet Explorer could be the root of the problem

from the circumstances - it has to be either upgraded or rolled back :-) And by no means allow all sorts of add-ons, plugins and extensions.

The authors decided that the explorer component ruled for displaying marketplace/signals/news/chat, but the explorer itself is a perpetual beta. And its problems "interfere" with the terminal

 

Good day to all.

Can we change the condition in the code: "Expert Advisor opens a position depending on the close of the last position. If there was no position, it opens depending on the direction of the previous candlestick" and we should changeit tothe possibility of placing 2 pending orders at a certain distance from the current price, and, when one of them triggers, the 2nd order will be deleted. The rest of the algorithm remains unchanged.

I tweaked it myself, but could not achieve a working version.

#property description "Советник открывает позицию в зависимости от закрытия прошлой позиции. Если позиции не было то в зависимости от направления прошлой свечи"
#property description "При достижение Т/P следующий ордер открывается в эту же сторону"
#property description "При достижение S/L следующий открывается в противоположную сторону"
//+------------------------------------------------------------------
#property  show_inputs
//+------------------------------------------------------------------
enum TT {BUY, SELL, BUYLIMIT, SELLLIMIT, BUYSTOP, SELLSTOP};
enum YN {No,Yes};
//+------------------------------------------------------------------
extern TT     Type         = BUY;
extern double Price        = 0; 
extern int    Distance     = 0;
extern int    stoploss     = 300,
              takeprofit   = 300;
extern double risk         = 0.01; //процент от депозита для рассчета объема первой позиции
extern double KoeffMartin  = 2.0;
extern int    OkrLOT       = 2;//округление лота
extern int    slippage     = 3;//Максимально допустимое отклонение цены для рыночных ордеров
extern int    MagicNumb    = 77;//Magic

double MINLOT,MAXLOT;                                  
//+------------------------------------------------------------------+
int OnInit()
{
   MAXLOT = MarketInfo(Symbol(),MODE_MAXLOT);
   MINLOT = MarketInfo(Symbol(),MODE_MINLOT);
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnTick()
{
   double OSL,OTP,OOP,SL,TP;
   int tip;
   double STOPLEVEL=MarketInfo(Symbol(),MODE_STOPLEVEL);
   for (int i=0; i
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
         if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumb)
         {
            tip = OrderType(); 
            OSL = NormalizeDouble(OrderStopLoss(),Digits);
            OTP = NormalizeDouble(OrderTakeProfit(),Digits);
            OOP = NormalizeDouble(OrderOpenPrice(),Digits);
            SL=OSL;TP=OTP;
            if (tip==OP_BUY)             
            {  
               if (OSL==0 && stoploss>=STOPLEVEL && stoploss!=0)
               {
                  SL = NormalizeDouble(OOP - stoploss   * Point,Digits);
               } 
               if (OTP==0 && takeprofit>=STOPLEVEL && takeprofit!=0)
               {
                  TP = NormalizeDouble(OOP + takeprofit * Point,Digits);
               } 
               if (SL != OSL || TP != OTP)
               {  
                  if (!OrderModify(OrderTicket(),OOP,SL,TP,0,White)) Print("Error OrderModify <<",GetLastError(),">> ");
               }
            }                                         
            if (tip==OP_SELL)        
            {
               if (OSL==0 && stoploss>=STOPLEVEL && stoploss!=0)
               {
                  SL = NormalizeDouble(OOP + stoploss   * Point,Digits);
               }
               if (OTP==0 && takeprofit>=STOPLEVEL && takeprofit!=0)
               {
                  TP = NormalizeDouble(OOP - takeprofit * Point,Digits);
               }
               if (SL != OSL || TP != OTP)
               {  
                  if (!OrderModify(OrderTicket(),OOP,SL,TP,0,White)) Print("Error OrderModify <<",GetLastError(),">> ");
               }
            } 
            return;
         }
      }
   }
   tip=-1;
   double Lot=0;
    for (i=OrdersHistoryTotal()-1; i>=0; i--)
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
      {
         if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumb)
         {
            if (OrderProfit()<0) 
            {
               Lot=lot(OrderLots(),KoeffMartin);
               tip=OrderType();
            }
            else 
            {
               Lot=lot(0,1);
               if (OrderType()==OP_BUY)  tip=OP_SELL;
               if (OrderType()==OP_SELL) tip=OP_BUY;
            }
            break;
         }
      }
   }

   if (tip==-1)
   {
      Lot=lot(0,1);
      if (Open[1]>Close[1]) tip=OP_BUY;
      else tip=OP_SELL;
   }
   if (tip==OP_BUY) if (OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bi  d,Digits),slippage,0,0,NULL,MagicNumb,Blue)!=-1) Comment("Open Sell");
   if (tip==OP_SELL) if (OrderSend(Symbol(),OP_BUY ,Lot,NormalizeDouble(Ask,Digits),slippage,0,0,NULL  ,MagicNumb,Blue)!=-1) Comment("Open Buy");                               
}
//--------------------------------------------------------------------

double lot(double l,double k)

{

   double ML = AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED);

   if (k==1) l = ML*risk/100;
   else l = NormalizeDouble(l*k,OkrLOT);
   if (l>ML) l = ML;
   if (l>MAXLOT) l = MAXLOT;
   if (l
   return(l);
}
//-----------------------------------------------------------------
            {
               Lot=lot(0,1);
               if (OrderType()==OP_BUY)  tip=OP_SELL;
               if (OrderType()==OP_SELL) tip=OP_BUY;
            }
            break;
         }
      }
   }

   if (tip==-1)
   {
      Lot=lot(0,1);
      if (Open[1]>Close[1]) tip=OP_BUY;
      else tip=OP_SELL;
   }
   
   if (tip==OP_BUY) if (OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bi  d,Digits),slippage,0,0,NULL,MagicNumb,Blue)!=-1) Comment("Open Sell");
   if (tip==OP_SELL) if (OrderSend(Symbol(),OP_BUY ,Lot,NormalizeDouble(Ask,Digits),slippage,0,0,NULL  ,MagicNumb,Blue)!=-1) Comment("Open Buy");                                 
}
//--------------------------------------------------------------------
double lot(double l,double k)
{
   double ML = AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED);
   if (k==1) l = ML*risk/100;
   else l = NormalizeDouble(l*k,OkrLOT);
   if (l>ML) l = ML;
   if (l>MAXLOT) l = MAXLOT;
   if (l
   return(l);
}
//-----------------------------------------------------------------
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Приказы на проведение торговых операций оформляются ордерами. Каждый ордер имеет множество свойств для чтения, информацию по ним можно получать с помощью функций Идентификатор позиции, который ставится на ордере при его исполнении. Каждый исполненный ордер порождает сделку, которая открывает новую или изменяет уже существующую позицию...
Files:
SSSR_v.1.mq4  11 kb
 
I'll try to rephrase the last post:

//--------------------------------------
According to the algorithm, the Expert Advisor opens a position depending on the close of a previous position.
If there was no position, it opens depending on the direction of the last candle.

This algorithm should be changed to:

Buy:

Place 2 pending orders BuyStop at the price specified in the settings and SellStop at the price specified in the settings.
As soon as the price reaches one of the stop orders, it moves into a market position with ТР and SL set. The order that did not trigger is deleted.

The rest of the algorithm remains unchanged, i.e: "When TP/P is reached, the next order is opened in the same direction".
"When S/L is reached, the next order is opened the opposite direction"
//---------------------------------------------------
Reason: