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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
datetime o_open = OrderOpenTime();
MqlDateTime dt_struct;
TimeToStruct( o_open, dt_struct;)
int min = dt_struct.min;
new sheets when writing to csv
Baffling. Tried from Excel to save a book with 3 sheets to csv:
There's only column separators inside the csv, there's no other markupOops! Didn't know this was a feature of the format. Me, when trying to save a book with multiple sheets, it doesn't unsubscribe like that... It just erases the previous sheet and saves a blank new one
Thank you!
You're welcome :)
Good afternoon. Can you please tell me please, Iwrote an indicator with Alert (message and sound outputs under certain conditions), everything works, but every time you change timeframe chart, again gives a signal. How can I fix it? The Alert code is placed in a separate function that is called to check from OnCalculate. If it is just an EA, it works fine, but I need it with graphical representation as I have done, without triggering again when change of timeframe.
When the timeframe is switched, the indicator starts from 0.
Accordingly, we should teach it to remember that Alert has already been issued - reliably, by storing such information in global variables of the terminal or in a temporary file, and it seems to be possible (I haven't used it myself) just to make a static variable.
For example, you can save time of last alert and not whistle a new Alert if time has passed less than 2 seconds.
and it seems to be possible (I haven't used it myself) just to make a static variable.
When you switch TF, a new copy of the indicator is created and the old one is deleted.
for EA it is possible (and necessary ?) to use static (or globally declared) variables ... there are however some nuances, but in general there are no problems
when you switch timeframe, indicator will start from 0.
prev_calculated will be reset to zero at the first call of OnCalculated()
i.e., create a global variable of the terminal or a graphic object as a marker that the indicator was already on this chart and look for this graphic object during the first call.
Colleagues, sorry at once for the elementary question, I just do not have a computer, but I have to.
TimeCurrent()https://www.mql5.com/ru/docs/dateandtime/timecurrent
Use the second version of the signature of this function:
ZS: I should tell at once - it works in MT4, I used it ;)
UPD: in MT4 I also used Hour() and Minute() - I don't use them for a long time, but they should give the last server time in hours and minutes