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

 
Vinin:
What did you want to get?
Generally, the result is an indicator that shows, cumulatively, the number of hauls and lowes by time. i.e. for example, for the year 20 hauls at 03:00, 30 lowes at 05:00 Something like a market profile, but peaks by time. The indicator is in a separate window.
 
SAnd7:

Thank you very much!

I wish the warrants would close as well...

If by time, we should find a function

OrderClose()

and put it in front of it.

if(Hour()>=HourClose)

Bottom line:

extern int    HourClose=0;          // Вставить там где вставили extern int    HourStart=0;  Это час закрытия

//+------------------------------------------------------------------+



//+------------------------------------------------------------------+
if(Hour()>=HourClose) OrderClose(...............);// Найти функцию OrderClose и поставить передней if(Hour()>=HourClose)


 

Thank you!!!

I think I've got it.

 
SAnd7:

Thank you!!!

I think I got it.

We can still play with the minutes.

  Minute()
 
SAnd7:

Hello!

I found a good Expert Advisor (according to the tester), I ran it on the demo and it is losing money in the Japanese session.

If you know the code, how to make it run at a certain time and at a certain time to close all my orders and then exit.

Also a place where to insert this code.

Thank you in advance!

Make 2 variables at the beginning:

extern int    Start    = 2,
              End      = 8;
//-----------------------------------
  int hour = TimeHour(TimeCurrent()); // в начале основной части советника

And then in the opening and closing conditions in case there is a position left!

     if(hour >= Start && hour < End) // можно открывать
//-----------------------------------------------------
     if(hour < Start || hour >= End) // закрыть, если есть
 

Hello!

Currently the function is linked to the current chart (double High[]). How can I modify the function so that I can get prices of different timeframes High_Lim(PERIOD_H4,10,1) High_Lim(PERIOD_M15,10,1)?

double High_Lim(ENUM_TIMEFRAMES GrafPeriod, int Bari_atp, int Bari_shift)
{
double HighLim=0; 
       HighLim = (High[iHighest(NULL,GrafPeriod,MODE_HIGH,Bari_atp,Bari_shift)]);
          
return(HighLim);
}

void OnTick()
  {
//---
Print("::::::::::::::::::::::::: High_Lim(PERIOD_M15,10,1) = ", High_Lim(PERIOD_M15,10,1));  
Print("::::::::::::::::::::::::: High_Lim(PERIOD_H4,10,1) = ", High_Lim(PERIOD_H4,10,1));     
  }
 
abeiks:

Hello!

Currently the function is linked to the current chart (double High[]). How can I modify the function so that I can get prices of different timeframes High_Lim(PERIOD_H4,10,1) High_Lim(PERIOD_M15,10,1)?

To find the highest price value from another symbol, use iHighest. There in place of 1 argument write the symbol name, eg. "EURUSD". In your function you wrote NULL, i.e. it searches the current chart.
 
paladin80:
To find the highest price value from another symbol, use iHighest. There, write the name of the symbol in place of 1 argument, e.g. "EURUSD". In your function you wrote NULL, i.e. it searches the current chart.
"...get prices of different timeframes..."
 
abeiks:
"...get prices of different timeframes..."

In iHighest the 2nd parameter is the timeframe.

   double val;
//--- расчет максимального значения цены на 20 последовательных барах
//--- с индекса 4 по индекс 23 включительно на графике  EURUSD на М30 
   int val_index=iHighest("EURUSD",PERIOD_M30,MODE_HIGH,20,4);
   if(val_index!=-1) val=High[val_index];
   else PrintFormat("Ошибка вызова iHighest. Код ошибки=%d",GetLastError());
 
paladin80:

In iHighest the 2nd parameter is timeframe.

iHighest is an index .

val=High[val_index] - High[] is linked to the current chart.

You wrote the same example that I already have, just in a different format.

Reason: