Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 195

 
 
fxsaber:
Please help.

is that .... ?

  const bool TradeTime = (TimeCurrent() % (24 * 60 * 60) < D'1970.01.01 23:50'); // exclude swaps
  
  if (TradeTime && (IntAsk - IntBid < Limit))
and mine?
 
Renat Akhtyamov:

this is ....

Forum on trading, automated trading systems & strategy testing

MT4-Tester VS MT5-Tester

fxsaber, 2017.05.08 11:28

Not going to argue. I ask forum members familiar with MQL4 to look at this short source and explain what Renat means.

I'm probably wrong, but I can't see where the history work in MT4 is coming from absentmindedly. Please help.
 
fxsaber:
Re-crossing warrants to the '70s, why?
 
Renat Akhtyamov:

Can you tell me which function checks the status of this checkbox?

ok. If we don't say anything, then it's the same as in the documentation:

Пример проверки:

if (!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) 
   Alert("Проверьте в настройках терминала разрешение на автоматическую торговлю!");

 
Проверка разрешения на торговлю для данного запущенного эксперта/скрипта

При запуске программы можно разрешить или запретить автоматическую торговлю конкретно для нее. Для этого есть отдельная специальная настройка в свойствах программы.

MQL_TRADE_ALLOWED

Пример проверки:

   if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
      Alert("Проверьте в настройках терминала разрешение на автоматическую торговлю!");
   else
     {
      if(!MQLInfoInteger(MQL_TRADE_ALLOWED))
         Alert("Автоматическая торговля запрещена в свойствах программы для ",__FILE__);
     }

 
Проверка разрешения на торговлю любым экспертам/скриптам для данного счета

Запрет на автоматическую торговлю может быть установлен на стороне торгового сервера. Пример проверки такой ситуации:

   if(!AccountInfoInteger(ACCOUNT_TRADE_EXPERT))
      Alert("Автоматическая торговля запрещена для счета ",AccountInfoInteger(ACCOUNT_LOGIN),
      " на стороне торгового сервера");

Если для торгового счета запрещена автоматическая торговля, то торговые операции из экспертов/скриптов выполняться не будут.
Проверка разрешения торговли для данного счета

Возможны случаи, когда для конкретного торгового счета запрещены любые торговые операции – нельзя торговать ни вручную, ни с помощью экспертов. Пример проверки ситуации, когда к торговому счету подключились с помощью инвесторского пароля:

   if(!AccountInfoInteger(ACCOUNT_TRADE_ALLOWED))
      Comment("Торговля запрещена для счета ",AccountInfoInteger(ACCOUNT_LOGIN),
            ".\n Возможно, подключение к торговому счету произведено по инвест паролю.",
            "\n Проверьте журнал терминала, есть ли там такая запись:",
            "\n\'",AccountInfoInteger(ACCOUNT_LOGIN),"\': trading has been disabled - investor mode.");

For some reason, this particular checkbox turned out to be disabled at the right moment, although a couple of minutes ago everything was OK!

Therefore, I strongly recommend to apply full check on each tick!!!

 

Please help with the brute force code, let's say we have variables with ranges: "A" from 2 to 6 with step 2, "B" from 1 to 3 with step 1, "C" from 0 to 1 with step 1 and "D" from 16 to 48 with step 4. It's necessary to arrange parameter enumeration, with variant of combination (external variable - giving access to any of combinations). How to implement this mechanism correctly?

 
-Aleks-:

Please help with the brute force code, let's say we have variables with ranges: "A" from 2 to 6 with step 2, "B" from 1 to 3 with step 1, "C" from 0 to 1 with step 1 and "D" from 16 to 48 with step 4. It's necessary to arrange parameter enumeration, with variant of combination (external variable - giving access to any of combinations). How to implement this mechanism correctly?


A small script

//+------------------------------------------------------------------+
//|                                                       Decode.mq4 |
//|                                            Copyright 2017, Vinin |
//|                                             http://vinin.ucoz.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, Vinin"
#property link      "http://vinin.ucoz.ru"
#property version   "1.00"
#property strict
#property script_show_inputs
//--- input parameters
input int N=162;  //0..162
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   for (int n=0;n<N;n++)
   {
      int tmp=n;
      int a=MathMod(tmp,3);
      tmp=(tmp-a)/3;
      int b=MathMod(tmp,3);
      tmp=(tmp-b)/3;
      int c=MathMod(tmp,2);
      tmp=(tmp-c)/2;
      int d=tmp;
   
      Print("N=",n,"; A=", 2+2*a, "; B=", b+1,"; C=",c,"; D=", 16+4*d);
   }
  }
//+------------------------------------------------------------------+

 
Victor Nikolaev:


A small script

This script hangs the terminal, after which the wind kills it.

 
-Aleks-:

This script hangs the terminal, after which the wind kills it.


So someone's out of luck. Once again. It's a script, not an EA or indicator
 
Victor Nikolaev:

A small script

It could be half the size if you remove completely unnecessary lines.

Why do a lot of people post in the source code for the forum hats, various comment constructs, logotypes, etc.?