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

 
STARIJ:

That would be great!!!


and at the beginning of the candle set immediately to the future min. max. ?

 

there is trolling, maybe something can be based on it

 
iisvlg:

there istrolling, maybe something can be based on it

The least you can do on the basis of trolling is a sauna for 24 hours :)

 
Artyom Trishkin:

The least you can do on the basis of trolling is a sauna for 24 hours :)


That was just a figure of speech. I think you get the gist of it.

 
Artyom Trishkin:

If the question is only about functions, then: if you want to receive data only from the current period of the chart - from the one on which the EA/script or indicator is running, then Open[] and Close[] are enough. If you want to get data from a certain timeframe, no matter what timeframe the Expert Advisor is running on, then iOpen() and iClose() will be enough.

But it would be better to make your own multiplatform function that will work equally in MT4 and MT5. You need to get data using CopyXXXX() function. In this case - CopyOpen() and CopyClose().


Please tell me the answer to the 2nd part of the question: how to measure the body of the candle, I understand, but how to do it exactly at 58 seconds of its life? This is fundamentally important for my strategy. Thanks in advance for the answer.

 
tura210577:

Please tell me the answer to the 2nd part of the question: I understand how to measure the body of the candle, but how to do it at 58 seconds of its life? This is fundamentally important for my strategy. Thank you in advance for the answer.

//+------------------------------------------------------------------+
//| Количество секунд, остающихся до закрытия свечи                  |
//+------------------------------------------------------------------+
long SecondsToCandleClose(const string symbol_name,const ENUM_TIMEFRAMES timeframe)
  {
   datetime array[];
   int copied=::CopyTime(symbol_name,timeframe,0,1,array);
   if(copied==1) return ::PeriodSeconds(timeframe)+array[0]-TimeCurrent();
   return 0;
  }
//+------------------------------------------------------------------+
 

Good afternoon, read the article by the respected moderator(Initialization of global program variables and other useful knowledge), but I don't understand how to put it into practice.

There are two functions in OnInit, #1 draws two buttons, #2 builds lines from a file. If you click on the button, part of the lines will be removed. If you change timeframe, OnInit will be activated and function 2 will automatically draw all lines. I need to change the timeframe to save the changes made by pressing the button. How to do this correctly?

 
WinProject:

Good afternoon, read the article by the respected moderator(Initialization of global program variables and other useful knowledge), but I don't understand how to put it into practice.

There are two functions in OnInit, #1 draws two buttons, #2 builds lines from a file. If you click on the button, part of the lines will be removed. If you change timeframe, OnInit will be activated and function 2 will automatically draw all lines. I need to change the timeframe to save the changes made by pressing the button. How to do this correctly?

Look at the attachment. Remove the line by hand or by button and switch the timeframe
Files:
TwoLines.mq4  9 kb
 
STARIJ:
Here's a look at the attachment. Remove the line by hand or button and switch the TF

Thank you!) everything worked out.

 

Good day, dear forum users.

Please help me with the following task:

I need to get the indicator data in mt4 using mql, e.g. MA5 with 1d timeframe, as of 14.30 of the day before yesterday.

i.e., if i ran the script with iMA the day before yesterday at 14.30, no questions would arise, but how do i get it today.

at least tell me where to dig