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

 
Forexman77:

Now you need to find the maximum price in this time range. I can find the maximum price:

but I can't tie it to the time range. Can you tell me how to do it?

I've built it up, but haven't tested it yet. It seems to work

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);
}
 
GBDD21:
how do you set up an EA?
with your hands, and with your head of course... :)
And, if you're in the middle of nowhere, you can familiarise yourself with it.
 
GBDD21:
how to set up an EA?
With a screwdriver
 
Still, how do I find the maximum of a given time interval? I've tried this and an alert to check, but it doesn't work.
datetime StartTime1=StrToTime(TimeToStr(TimeCurrent(),TIME_DATE)+" 12:00");
datetime StopTime1=StrToTime(TimeToStr(TimeCurrent(),TIME_DATE)+" 23:00");

if(TimeCurrent()>=StartTime1 && TimeCurrent()<=StopTime1)
    {
    int BarStart = iBarShift(NULL,0,StartTime1,false);
    int BarEnd   = iBarShift(NULL,0,StopTime1,false);
    double Max_Price=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,BarStart-BarEnd,BarEnd));
       if (Max_Price==true)
            {
            Alert(" Max_Price= ",Max_Price);
            }
   }
 
GBDD21:
how to set up an EA?
https://www.mql5.com/ru/articles/1385 - article "Testing and optimising EAs"
 
Hello all, please tell me who knows! I want to subscribe to a trading signal ( paid) and work on my desktop computer during the day and leave it on my netbook at night .... do i have to subscribe twice in two terminals? my question is if i have subscribed to the signal but i open the second terminal and it is empty.... i would like to ask you a more exact question. is it possible to open one and the same subscription (signal) on different terminals (on one account, of course) ....?
 
Forexman77:
Still, how do I find the maximum of a given time interval? I tried to do it this way and to check the alert, but it doesn't work.

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

#property copyright "Copyright 2013, Mikhail <Sepulca>  Kozhemyako"
#property link      "ua3xcm@obninsk.ru"
extern int StartHour=8;
extern int StartMinute=1;
extern int StopHour=23;
extern int StopMinute=58;
int OldBar;
int init() { OldBar=Bars-1;return(0);}
int deinit() {return(0);}
int start(){
 double Maximum;
 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;// Сколко баров длится временной интервал
  Maximum=iHigh(Symbol(),PERIOD_M1,iHighest(Symbol(),PERIOD_M1,MODE_HIGH,count,start));//Находим максимум на заданном временном интервале
 }
 else Maximum=-1;
 if(OldBar<Bars){Print("Текущее время в минутах=",CurrentMinutesFromDayStart," Максимум с ",StartTime," минуты по ",StopTime," минуту =",DoubleToStr(Maximum,Digits));OldBar=Bars;}
 return(0);
}
 
Hello. I'm trying to install a template in Metatrader in a VPS, but it won't work, although everything works fine on my home computer, can you tell me what the problem is?
 
Sepulca:

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


Thank you very much. Just fell off the wagon today. Had money stolen from my kiwi wallet((( Just now finished with the emails about the theft.

 
artmedia70:
Screwdriver
That's a rough adjustment! A thinner tuning for the soul to sing!
Reason: