[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 449

 

I apologise for duplicating a question, but I can't do the following examples until I get this sorted out.

Please help me to figure it out.

I wrote a simple script to open an order (from MQL4 tutorial).

int start()                                  // Спец. функция start()
  {                                          // Открытие BUY
   OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
   Alert (GetLastError());
   return;                                   // Выход из start()
  }

I coded it for 4 digits instruments.

I have an account with a company that has 5 digits after the dot.

Please advise how to correct code for 5 digits and why error 4109 (trading not allowed) is displayed when script runs?


 
Pacman:

I apologise for duplicating a question, but I can't do the following examples until I get this sorted out.

Please help me to figure it out.

I wrote a simple script to open an order (from MQL4 tutorial).

I coded it for 4 digits instruments.

I have an account with a company that has 5 digits after the dot.

Can you please modify code for 5 digits and why error 4109 (trading not allowed) appears when running script?

int start()                                  // Спец. функция start()
  {                                          // Открытие BUY
   OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-150*Point,Bid+150*Point);
   Alert (GetLastError());
   return;                                   // Выход из start()
  }

Except that it doesn't have to work at all. You need to check stop and take sizes for validity by your brokerage company

ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed. You need to enable the "Allow EA to trade" option in the EA properties.
 
artmedia70:

Except that it doesn't necessarily work. We need to check stop and take sizes to see if they are allowed by your brokerage company's stopwatch

ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed. You should enable "Allow EA to trade" option in EA properties.

Thank you very much!

Needed to allow EA to trade)

 

Good day to all.

Apologies if this question has been raised before, but I have to go through 540 pages.

This is the problem. In MT4, the orders with the same price overlap and only one order is visible. Are there any settings in MT4 so that, for example, two orders on the chart are displayed side by side without overlapping each other. If there are no such settings, is it possible to create a table or a chart with such a function?

 
pyrsikov:

Good day to all.

Apologies if this question has been raised before, but I have to go through 540 pages.

This is the problem. In MT4, the orders with the same price overlap and only one order is visible. Are there any settings in MT4 so that, for example, two orders on a chart are displayed side by side without overlapping each other. If there are no such settings, is it possible to create a table or a chart with such a function?

Ctrl+t and a table of all open positions appears at the bottom if you switch to the "Trade" tab.
 

Please help me out - I'm writing an EA - I've used code as a substrate;

if(drawBacker){
for(int x=0;x<7;x++)
for(int y=0;y<29;y++)
{
ObjectCreate("A_Fon "+x+y,OBJ_LABEL,0,0,0,0);
ObjectSet("A_Fon "+x+y, OBJPROP_CORNER, positionWindow); // positionWindow // Txt_Location
ObjectSet("A_Fon "+x+y,OBJPROP_XDISTANCE,x*20+5);
ObjectSet("A_Fon "+x+y,OBJPROP_YDISTANCE,y*20+9);
ObjectSetText("A_Fon "+x+y,CharToStr(110),26, "Wingdings",colorSubstrate);//Red);
}
if (drawWingdings==False)
{
for( int posp=1000;posp>0;posp--)
{
ObjectDelete("A_Fon "+posp);
ObjectDelete("A_Fon0"+pospp);
ObjectDelete("A_Fon00");
}
}
}

As a result, I've got a mess, as a huge number of objects are drawn on the chart.

Please tell me the normal code to set the background of the text.

 
7777877:

Good afternoon... Question about FileIsEnding and FileIsLineEnding functions. In order to understand how FileIsEnding and FileIsLineEnding functions work, I wrote the following script:

After a number is written to the file, if you look in hexadecimal form, there will be the following entry

00000000: 31 2E 33 35 38 34 0D 0A | | 1.3584...

Each letter or number takes 1 byte or 8 bits, the last two characters are called line feed and carriage return, they are appended automatically so the file size is 8 bytes not 6.

Run your slightly modified script and notice how the cursor moves (deliberately made the enumeration larger than the file size, so you can see where the error occurs.

int start()                                                              //функция start
  {                                                                      //начало start
   double Timestart=GetTickCount();                                      //переменная, с помощью которой вычисляется время (в милисекундах) начала выполнения эксперта 
   string name="Копия Запись чисел в файл.csv";                          //имя создаваемого файла
   bool h;                                                               //переменная: значение функции FileIsEnding
   bool h_l;                                                             //переменная: значение функции FileIsLineEnding
   int error;                                                            //переменная: ошибка
   int handle=FileOpen(name,FILE_CSV|FILE_WRITE,';');                    //открываем заданный файл n записываем туда данные
   int запись=FileWrite(handle,DoubleToStr(1.3584,4));                   //записываем цены OHLC в файл csv (в преобразованном виде, т.е в виде текста)
   FileClose(handle);                                                    //закрываем файл
//---------------------------------------------------------------------------------------- 2 -
   handle=FileOpen(name,FILE_CSV|FILE_READ,';');                         //открываем заданный файл
   int size=FileSize(handle);                                            //вычисляем размер заданного файла
   Print("Размер файла ",name," составил ",size," байт");
   for(int i=0;i<=size;i++)
   {
   GetLastError();
   bool pos=FileSeek(handle,i,SEEK_SET);                                 //смещаем от начала вправо указатель файла
   int pos1=FileTell(handle);
   double чтение=FileReadNumber(handle);                                 //считываем число из текущей позиции (уже измененной функцией FileSeek) файлового указателя
   h=FileIsEnding(handle);                                               //устанавливаем текущее значение переменной h
   h_l=FileIsLineEnding(handle);                                         //устанавливаем текущее значение переменной h_l
   error=GetLastError();                                                 //значение ошибки, производимой функцией FileIsEnding
   if(error!=0)Alert("Текущая ошибка ",error);                           //если код текущей ошибки не равен 0, то получаем номер текущей ошибки
//----------------------------------------------------------------------------------------- 3 -
   Print(" Функция FileSeek вернула: ",pos,
         " Указатель находится в позиции - ",pos1,
           " Функция FileReadNumber(handle) вернула: ",чтение);//печать сообщения 
   }
   FileClose(handle);                                                    //закрываем файл
//----------------------------------------------------------------------------------------- 4 -
   return(0);                                                             //выход из start
  }                                                                       //конец start
//-------------------------------------- КОНЕЦ START -------------------------------------- 5 -
 

When debugging the indicator, you need to print out an array of price and time values from certain bars on the shifft.

      price1 = iMA(Symbol(),i_maTF,i_maPeriod,i_maShiftByPrice,i_maMethod,i_maPrice,i_shiftBarsBack1+i);       // Цена в точке А
      price2 = iMA(Symbol(),i_maTF,i_maPeriod,i_maShiftByPrice,i_maMethod,i_maPrice,i_shiftBarsBack2+i);       // Цена в точке В
      time1 = iTime(Symbol(),Period(),i_shiftBarsBack1 + i - 1);                                               // Время в точке А
      time2 = iTime(Symbol(),Period(),i_shiftBarsBack2 + i - 1);                                               // Время в точке В

I get all this inside the operator, of course:

for(i = limit - 1;i > 0;i--)

Then, I transfer the price and time values to arrays in order to work with them further:

      varsPrice1[i] = price1;                                                                        // Массив цен в точке А
      varsPrice2[i] = price2;                                                                        // Массив цен в точке В
      varsTime1[i] = time1;                                                                          // Массив времени в точке А
      varsTime2[i] = time2;                                                                          // Массив времени в точке В

I try to print out what I already have immediately afterwards:

      Print("i = ", i," time1 = ", time1, " price1 = ", price1);
      Print("i = ", i," time2 = ", time2, " price2 = ", price2);
      Print("i = ", i," varsTime1[i] = ", varsTime1[i], " varsPrice1[i] = ", varsPrice1[i]);
      Print("i = ", i," varsTime2[i] = ", varsTime2[i], " varsPrice2[i] = ", varsPrice2[i]);

This is what is printed in the Expert Log:

2012.10.20 14:47:13     2010.08.10 02:58  AngleByTg GBPUSD,M5: i = 41 varsTime1[i] = 1281381900 varsPrice1[i] = 0
2012.10.20 14:47:13     2010.08.10 02:58  AngleByTg GBPUSD,M5: i = 41 time2 = 1281382200 price2 = 0
2012.10.20 14:47:13     2010.08.10 02:58  AngleByTg GBPUSD,M5: i = 41 time1 = 1281381900 price1 = 0
2012.10.20 14:47:13     2010.08.10 02:58  AngleByTg GBPUSD,M5: i = 42 varsAngle[i] = 0
2012.10.20 14:47:13     2010.08.10 02:58  AngleByTg GBPUSD,M5: i = 42 varsTime2[i] = 1281381900 varsPrice2[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 45 varsTime2[i] = 1281381000 varsPrice2[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 45 varsTime1[i] = 1281380700 varsPrice1[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 45 time2 = 1281381000 price2 = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 45 time1 = 1281380700 price1 = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 46 varsAngle[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 46 varsTime2[i] = 1281380700 varsPrice2[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 46 varsTime1[i] = 1281380400 varsPrice1[i] = 0
2012.10.20 14:47:12     2010.08.10 02:56  AngleByTg GBPUSD,M5: i = 46 time2 = 1281380700 price2 = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 91 time1 = 1281366600 price1 = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 92 varsAngle[i] = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 92 varsTime2[i] = 1281366600 varsPrice2[i] = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 92 varsTime1[i] = 1281366300 varsPrice1[i] = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 92 time2 = 1281366600 price2 = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 92 time1 = 1281366300 price1 = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 93 varsAngle[i] = 0
2012.10.20 14:47:11     2010.08.10 02:54  AngleByTg GBPUSD,M5: i = 93 varsTime2[i] = 1281366300 varsPrice2[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 45 varsAngle[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 45 varsTime2[i] = 1281380700 varsPrice2[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 45 varsTime1[i] = 1281380400 varsPrice1[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 45 time2 = 1281380700 price2 = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 45 time1 = 1281380400 price1 = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 46 varsAngle[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 46 varsTime2[i] = 1281380400 varsPrice2[i] = 0
2012.10.20 14:47:10     2010.08.10 02:52  AngleByTg GBPUSD,M5: i = 46 varsTime1[i] = 1281380100 varsPrice1[i] = 0
2012.10.20 14:47:09     2010.08.10 02:50  AngleByTg GBPUSD,M5: i = 49 varsTime1[i] = 1281379200 varsPrice1[i] = 0

Here we can clearly see that price values of both varsTime1[i] andvarsTime2[i] and just prices from time1 andtime2 are always 0. What's wrong with that?

 
Vinin:

You should give us the whole code. You don't want to guess what is clear to you.

I understand that I don't want to guess, but can you at least give me a hint, if the problem is clear to you?
 
Hi forum users!!!!
Guys, I have a question - who knows in what file are stored scripts assigned to "hotkeys"? I want to save this file with the appointed already "Hotkeys" that every time after reinstallation of the terminal if suddenly there is such a need, not to assign these keys again ... but only file copied and all ...
Thank you all in advance.
Reason: