Useful features from KimIV - page 106

 
vvg:


I wanted to use this function but faced the following situation: when a new extremum appears, the price level does not change immediately but remains the same for some time. It disturbs me during testing. How to fix it?

Please provide material evidence: symbol, date, time, price. I would like to repeat your situation.
 
KimIV:
vvg:


I wanted to use this function, but I faced the following situation: when a new extremum appears, the price level does not change immediately, but stays the same for some time.

It hinders testing. How to fix it?

Please provide material evidence: symbol, date, time, price. I would like to repeat your situation.
Good evening! I have attached a code to my EA allowing it to trade at a certain period of time, but the EA keeps on trading, although it has not had any errors during compilation! And I cannot make it trade on the volatility of the market (to open a deal if the volatility is over 50)! Could you please show me how to do it, because I'm already exhausted! Thanks in advance!!!!
Files:
dmx.mq4  3 kb
 

Why did you put your function in the global variables?

// Prevent Expert Advisor from trading C and OP
if ( (Hour()==20 && Minute()>=59) && (Hour()==08 && Minute()>=59) )
return;

It must be placed at start! Probably, when the loop goes from start, it will see the wrong condition and will exit without opening positions. This should work for you.


Files:
dmx_1.mq4  3 kb
 
LLIAMAH:

Why did you put your function in the global variables?

// Prevent Expert Advisor from trading C and OP
if ( (Hour()==20 && Minute()>=59) && (Hour()==08 && Minute()>=59) )
return;

It must be placed at start! Probably, when the loop goes from start, it will see the wrong condition and will exit without opening positions. This should help you.


Thank you, but unfortunately no change
 
dimas7469:
Thank you, but unfortunately no change.

if ( (Hour()==20 && Minute()>=59) && (Hour()==08 && Minute()>=59) ) 
return;

I see...

if (Hour()>=21 || Hour()<=9) 
return;

That's the way it should be.
No need to complicate what can be simplified...

 
todem:
what the apersand at the end of "double&" is for
This indicates that an array declared in EA variables is passed to the function by reference. After returning from the function, this array will contain the values that this function has written into it.
 
Good afternoon. Dear KimIV. Your e-News-Lucky$ EA opens stop orders. Can you re-do it to open Limits? I am not an expert in computer programming :)), therefore I am asking for your help. I would be glad.
Files:
 

How to make:

If Condition1 is met, then don't check it again, and check Condition2 on the next ticks and so on?

static bool Val_max, Cl_dn, Val_min; //static or global
                                        |
//+------------------------------------------------------------------+
int start()
  {
   int j;
   double bid;                                         
   bid=Bid;                                    // Текущая цена продажи
   string
   Symb=Symbol();                               // Название фин.инстр.
double Value_max=1.0000;
double Value_min=0.9980;
double Open_1=Open[1];
double Close_1=Close[1];
//----

//--------------------------------------------------------------- 4 --

double Val=iCustom(NULL, 0, "Название Польз. Индикатора",0,0);   // Присваиваем пер. Val значение польз. индикатора
if (Условие1)
{
 Val_max=true;                  // 
 Alert("Значение инд. >= Value_max (исп. 1-е усл.)");
}
if (Условие2)
{
 Cl_dn=true;
 Alert("1 бар закрылся падением (исп. 2-е усл.)");
}
if (Условие3 && Cl_dn==true)
{
 Val_min=true;
 Alert("Значение инд. <= Value_min (исп. 3-е усл.)");
}
if (Val_max==true && Cl_dn==true && Val_min==true)
  {
   for (j = 0; j < OrdersTotal(); j++)
    {
     OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol() == Symbol())
      {
      if (OrderType() == OP_SELL) return(0);
      }
    }
   
   OrderSend(Symbol(),OP_SELL,0.1,NormalizeDouble(Bid,Digits),2,Bid+400*Point,Bid-400*Point,"",3,Red);  // Открытие SELL
   Val_max=false; Cl_dn=false; Val_min=false;
  }

//----
   return(0);
  }
 
Can you tell me if there is a script in the theme that closes all open orders when the total profit of n pips is reached ?
 

Hello Igor. I am using your function IniFiles.mqh, it is perfect for my purposes. Thank you very much.

Do you have (ready and willing to buy)))) the same but for working with excel? Tried several options like this https://www.mql5.com/ru/code. But reading from a cell file is accompanied by an explicit opening of the file on the desktop every tick. Is it possible to programmatically read data from cells as in IniFiles ? I need this to read data from a Quick DDE.

Reason: