[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 195

 

Good afternoon, gentlemen.

Still need your advice on this question:

I am writing an EA and I ran into a problem. According to TS, the Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and the calculations should start from the beginning.

And so the cycle by cycle. The time cycle is from 1 to 60 minutes. Please advise how to describe this correctly in the code. How can I make the following code cyclic and with the ability to set the cycle time from 1 to 60 minutes?

So far my 5 minute loop looks like this :

if ((TimeMinute(TimeCurrent()))==time1)

Price20=koef_10;

if ((TimeMinute(TimeCurrent()))==time2)

Price20=koef_10;

if ((TimeMinute(TimeCurrent()))==time3)

Price20=koef_10;

if ((TimeMinute(TimeCurrent()))==time4)

Price20=koef_10;

if ((TimeMinute(TimeCurrent()))==time5)

Price20=koef_10;


I would appreciate your help.

 
extralifes:

Good afternoon, gentlemen.

I still need your advice on this question:

I am writing an EA and I ran into a problem. According to TS , the Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and the calculations should start from the beginning.

And so the cycle by cycle. The time cycle is from 1 to 60 minutes. Please advise how to describe this correctly in the code. How can I make the following code cyclic and with the ability to set the cycle time from 1 to 60 minutes?

So far my 5 minute loop looks like this :


I would appreciate your help.

This is your repeated post.

It seems to me that people just don't understand what you're asking.

try rephrasing the highlighted phrases

 
sergeev:

this is your repeated post.

It seems to me that people just don't understand what you're asking.

Try rephrasing the highlighted phrases



I think it should be reset in the header of the programme. Right? I don't understand about the other one.
 
extralifes:

Good afternoon, gentlemen.

Still need your advice on this question:

I am writing an EA and I ran into a problem. According to TS, the Expert Advisor should perform calculations every minute for a given number of minutes. After that, all data should be reset and the calculations should start from the beginning.

And so the cycle by cycle. The time cycle is from 1 to 60 minutes. Please advise how to describe this correctly in the code. How can I make the following code cyclic and with the ability to set the cycle time from 1 to 60 minutes?

So far my 5 minute loop looks like this :


I would appreciate your help.


Should we use while instead of if?
 
nlp2311:

Good afternoon!

The question is as follows. I set the indicator to switch by historical data through

I know you can do it through buffers in the form of lines, but I don't want to, as there are only 8 buffers ! I have done it with multiple induks, but again I am not satisfied with it due to many different reasons....(:

QUESTION #1.

How can you do a history shift viaiBarShift .

I.e. the point is that I put the date in global variables (e.g. "02.06.2010 07:00") and then pressing the hotkey (Cntrl+I) goes addition to iBarShift . And the indicator values are shifted, i.e. tested))): visually.

Also QUESTION #2.

How to prescribe in the indexer code a "hotkey" (not MT4 !!!!, but for the indexer code, for example, to add or subtract history).

Through hooks, apparently, especially if you want to override control+I.

QUESTION #3.

And where can I get ASII codes for hotkeys???

You probably won't need them, but if you really need them, here.
 
alsu:

Through hooks, apparently, especially if you want to override control+I.

You probably won't need them, but if you really need them, here.

Thanks! Fun...):

An example with hooks))): would give))): indicator or part...

=========================== =================

The MAIN QUESTION was about

QUESTION #1.

How can I do a history shift via iBarShift .

I.e. the point is that I put the date in global variables (eg "02.06.2010 07:00"), and then pressing the hotkey (Cntrl + I) goes addition to iBarShift . And the indicator values are shifted, i.e. tested))): visually. It is clear that one should primitively add to iBarShift or subtract...

The question is about CAN or CANNOT?

 
I may not have figured out what to do, but:
You can move the graph left-right by overwriting the contents of the cells in the indicated buffer into adjacent ones. You do not neediBarShift for this.
 
MikeM:
I may not have figured out what to do, but:
You can move the graph left-right by overwriting the contents of the cells in the indicated buffer into adjacent ones. Andno iBarShift is needed for this.
This is probably what you need. Also you can try via SetIndexShift(), but I'm not sure that it will re-draw in general (in my memory it seems to work only in init())
 
There's also an article on parameter management using graphical objects, which may come in handy.
 

Good afternoon. Here's a question. Inthe MQL4S.K.book , in "GlobalVariables" chapter in "Properties of GV Variables" it says: "A GV variable can only have the type double". Below, in the section "GlobalVariableDel() function", there is an example of an Expert Advisor globalvar.mq4 that contains the following content:

//--------------------------------------------------------------------
// globalvar.mq4
// Предназначен для использования в качестве примера в учебнике MQL4.
//--------------------------------------------------------------------
int    Experts;                                 // Колич. экспертов
double Depo=10000.0,                            // Заданный депозит
       Persent=30,                              // Заданный процент     
       Money;                                   // Искомые средства
string Quantity="GV_Quantity";                  // Имя GV-переменной
//--------------------------------------------------------------------
int init()                                      // Спец. функция init
  {
   Experts=GlobalVariableGet(Quantity);         // Получим тек. знач.
   Experts=Experts+1;                           // Колич. экспертов
   GlobalVariableSet(Quantity, Experts);        // Новое значение
   Money=Depo*Persent/100/Experts;              // Средства для эксп.
   Alert("Для эксперта в окне ", Symbol()," выделено ",Money);
   return;                                      // Выход из init()
  }
//--------------------------------------------------------------------
int start()                                     // Спец. функция start
  {
   int New_Experts= GlobalVariableGet(Quantity);// Новое колич. эксп.
   if (Experts!=New_Experts)                    // Если изменилось
     {
      Experts=New_Experts;                      // Теперь текущ. такое
      Money=Depo*Persent/100/Experts;           // Новое знач. средств 
      Alert("Новое значение для эксперта ",Symbol(),": ",Money);
     }
   /*
   ...
   Здесь долен быть указан основной код эксперта,
   в котором используется значение переменной Money
   ...
   */
   return;                                      // Выход из start()
  }
//--------------------------------------------------------------------
int deinit()                                    // Спец. ф-ия deinit
  {
   if (Experts ==1)                             // Если эксперт один..
      GlobalVariableDel(Quantity);              //..удаляем GV-перемен
   else                                         // А иначе..
      GlobalVariableSet(Quantity, Experts-1);   //..уменьшаем на 1
   Alert("Эксперт выгружен из окна ",Symbol()); // Сообщ. о выгрузке
   return;                                      // Выход из deinit()
  }
//--------------------------------------------------------------------

Question: why are theExpert and New_Expertglobal variables ofint type in this example , even though, as stated earlier, these variables should be ofdouble type ?

Thank you in advance for your answer

Reason: