Questions from Beginners MQL5 MT5 MetaTrader 5 - page 539
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
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
comp, 2016.03.23 09:49
How do I know the chart period by ChartID?ChartGetInteger does not allow to do this in one action.
So far I've come up with a crutch solution by saving a template and parsing the period in it.
How to find out normally?
UseChartPeriod
ChartPeriod
Returnsperiod value of the specified chart.
ENUM_TIMEFRAMESChartPeriod(
longchart_id=0// chart ID
);
Parameters
chart_id=0
[Chart ID. 0 means the current chart.
Returned value
Value ofENUM_TIMEFRAMES type. If there is no chart, 0 is returned.
UseChartPeriod
Good afternoon!
How can the status of the one-click trading panel be determined (unfolded or collapsed)?
Tell me how to search for questions on the right topic in this beginner's thread. The thread has grown into a huge layer of questions and answers and so manually searching is no longer possible. Asking a question already hesitates, maybe it has already been answered here a long time ago, and the search is done throughout the site and not in this particular section "for beginners" ?
Type in a google search: search site:https://www.mql5.com/ru/forum/6343
"Searchable" is what you're looking for.
Good afternoon!
I can't figure out how to process the bars for two hours, say from 3pm to 5pm server time, for the last 250 trading sessions.
Could you please give me a conceptual suggestion?
mql5
Good afternoon!
I can't figure out how to process the bars for two hours, say from 3pm to 5pm server time, for the last 250 trading sessions.
Could you please give me a conceptual suggestion?
mql5
Use the functions with time query
Sergey,
thanks for the reply!
For my task it is more convenient to
void OnStart()
{
datetime start =StringToTime("2016.03.25 15:00");
datetime stop =StringToTime("2016.03.25 15:55");
MqlRates rates[];
ArraySetAsSeries(rates,true);
int copied=CopyRates(_Symbol,PERIOD_M5,start,stop,rates);
if(copied>0)
{
Print("Copied bars: "+copied);
string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
string out;
int size=fmin(copied,10);
for(int i=0;i<size;i++)
{
out=i+": "+TimeToString(rates[i].time);
out=out+"+StringFormat(format,
rates[i].open,
rates[i].high,
rates[i].low,
rates[i].close,
rates[i].tick_volume);
Print(out);
}
}
else Print("Failed to get historical data on symbol ",Symbol());
}
How can I remove Saturdays and Sundays?
More precisely, do a similar operation for the last, say, 250 trading days?
Sergey,
thanks for the reply!
For my task it is more convenient to
void OnStart()
{
datetime start =StringToTime("2016.03.25 15:00");
datetime stop =StringToTime("2016.03.25 15:55");
MqlRates rates[];
ArraySetAsSeries(rates,true);
int copied=CopyRates(_Symbol,PERIOD_M5,start,stop,rates);
if(copied>0)
{
Print("Copied bars: "+copied);
string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
string out;
int size=fmin(copied,10);
for(int i=0;i<size;i++)
{
out=i+": "+TimeToString(rates[i].time);
out=out+"+StringFormat(format,
rates[i].open,
rates[i].high,
rates[i].low,
rates[i].close,
rates[i].tick_volume);
Print(out);
}
}
else Print("Failed to get historical data on symbol ",Symbol());
}
How can I remove Saturdays and Sundays?
To be more precise, how to make a similar operation for the last, say, 250 trading days?
Try to work with this structure