Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 104

 
hoz:

What you have here is nothing at all. Let's start with the fact that closing a short is always on ASK, not BID.

Figured it out. It's simple.
     Price = NormalizeDouble(Ask, Digits); // округляем до нужного нам числа цифр после запятой
     if(StopLoss > 0)
      {
       SL = iHigh(Symbol(),0,1)+30*Point; // вычисляем стоплос
       SL = NormalizeDouble(SL, Digits); // округляем до нужного нам числа цифр после запятой
      }
 
Question for all forum members. The above code works for all pairs - five digits after the decimal point, but I cannot set stop loss on yen - 3 digits after the decimal point. Why?
 
alexey1979621:

Sorted. Simple question for all forum members. The above code works for all pairs - five digits after the comma, but for the yen - 3 digits after the comma stop losses are not set. Why?
https://book.mql4.com/ru/appendix/limits
 
artmedia70:
I have already written an example function.

I forgot to put one check in the example:

if (OrderType()>1)            continue;            // Сначала забыл вписать, подправил

Corrected in my post

 

Yusuf, are you holding down a key on your keyboard? Like Shift or Ctrl?

I had a similar thing a few years ago, the ESC key got caught in the corner of a book and I didn't know what happened, the computer reacted unusually to keystrokes.

Also: did the keyboard ever get soaked in tea/coffee/orange juice?

 
i_logic:
And also: no tea/coffee/orange juice on the keyboard?

We could go on:

Kitty-dogs haven't been naughty? No head on the keyboard/cloud on the head? :)))

 
Bg))
 
Please advise: the broker for EUR/USD has five digits after the decimal point in the prices, the fractals give out 4, both stock and custom ones. And they don't round the fifth digit, they discard it. I haven't encountered this subject anywhere. Maybe there is a way to set the number of digits after the decimal point?
 
Trendy:
Please advise: the broker for EUR/USD has five digits after the decimal point in the prices, the fractals give out 4, both stock and custom ones. And they don't round the fifth digit, they discard it. I haven't encountered this subject anywhere. Maybe there is a way to set the number of digits after the decimal point?
DoubleToStr(number,digit) is your best bet
 
Sepulca:

Well I've already written and now I've tested it, it works


Good afternoon!

Sorry for bringing up a relatively old topic. Everything has become clear with the code.

Now I have a snag, how to open a trade. For example, right after a given range, we're looking for

The price is lower than the maximum by a certain amount of points. We open a deal.

I have tried to add such a code and run it in the tester, but it does not open deals.

What should I do?

МОЙ КОД, КОТОРЫЙ НУЖНО ДОБАВИТЬ:

signal = Maximum - iClose(Symbol(),Period(),0);
if (signal > 0.0012)
        {                                          
        Opn_S=true;                  
        }
ВАШ КОД:
int start(){
 int StartHour=8,StartMinute=1;// Время 08:01
 int StopHour=23,StopMinute=58; // Время 23:58
 int StartTime=StartHour*60+StartMinute;
 int StopTime=StopHour*60+StopMinute;
 int CurrentMinutesFromDayStart=Hour()*60+Minute();// Текущее время в минутах от начала дня
 if(CurrentMinutesFromDayStart>=StartTime && CurrentMinutesFromDayStart<=StopTime) {
  // Для торговли внутри дня
 }
// Ищем максимум
 datetime td=iTime(Symbol(),PERIOD_D1,0);// Время открытия дневного бара в секундах от 01.01.1970
 int start=0;// Если конец временного диапазона ещё не наступил, начинаем поиск максимума с текущего бара
 if(CurrentMinutesFromDayStart>StopTime) {
  datetime ts=td+StopTime*60;// конец временного диапазона в секундах от 01.01.1970
  start= iBarShift(Symbol(),PERIOD_M1,ts,false);// смещение бара, которому принадлежит ts
 }
 int count=0;// Сколько баров до StartTime
 if(CurrentMinutesFromDayStart>StartTime) {
  ts=td+StartTime*60;// начало временного диапазона в секундах от 01.01.1970
  count= iBarShift(Symbol(),PERIOD_M1,ts,false);// смещение бара, которому принадлежит ts
  count= count-start;// Сколько баров длится временной интервал
 }
 double Maximum=iHigh(Symbol(),PERIOD_M1,iHighest(Symbol(),PERIOD_M1,MODE_HIGH,count,start));//Находим максимум на заданном временном интервале
 return(0);
}
 

Hello!

I may be in the wrong forum, but I have a question.

If you have 2 windows open with the same broker and the same account, there might be some slowness or glitches in the terminal or transactions will take longer to execute?

Please advise me, I really need it to trade on the news!