Questions from Beginners MQL5 MT5 MetaTrader 5 - page 353
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
this (below) doesn't work, I typed F_Path into explorer, clicked enter, file opens... Does WinApi info look like this?
Who prevents the FILE_COMMON flag from being used when writing and reading? The file will be available to all terminals installed on the system. It will be in the shared folder of all terminals.
In ME File --> Open shared data folder
Who prevents the FILE_COMMON flag from being used when writing and reading? The file will be available to all terminals installed on the system. It will be located in the shared folder of all terminals.
In ME File --> Open shared data folder
Hello, has anyone encountered this problem when creating a trade request with parameters:
if I put the following parameters:
mrequest.action=TRADE_ACTION_DEAL;mrequest.type_filling=ORDER_FILLING_FOK;
mrequest.type=ORDER_TYPE_BUY;
the terminal announces that I have specified an invalid method mrequest.type_filling(order execution policy); if I specify mrequest.type_filling=ORDER_FILLING_RETURN, the order is opened but I cannot close it programmatically because the terminal reports that an invalid method is being used. I am running the Expert Advisor on a forex server and everything is working fine on other servers. Can someone write an order execution policy that can be used when developing trading robots for this broker? Thank you.There is an mq4 indicator with Alert function.
For example:
How to make it so that either in the upper left corner of the subwindow (where the indicator name and parameters are usually displayed), or somehow else, indicate whether the signal is on(extern bool AlertMode=true;) or off?There is an mq4 indicator with Alert function.
For example:
How to make either in the upper left corner of the subwindow (where the indicator name and parameters are usually displayed), or somehow else, to indicate if the signal is enabled(extern bool AlertMode=true;) or disabled?The documentation says that:
При тестировании в эксперте можно обрабатывать пользовательские события с помощью функции OnChartEvent(), но в индикаторах эта функция в тестере не вызывается. Даже если индикатор имеет обработчик OnChartEvent() и этот индикатор используется в тестируемом эксперте, то сам индикатор не будет получать никаких пользовательских событий.
At the moment this statement is not relevant - in indicators this function is called in the tester, at least one indicator can receive events generated by another indicator in the tester.
The problem is that once the indicator receives the call of this function, it has no access to data stored in the variables declared at global level, and vice versa - all changes made in this function are not stored in the variables of global access level.
Examples:
1. object is declared globally and initialized in the OnInit function. It can be accessed from the OnCalculate function, but we get an error message in the OnChartEvent function - invalid pointer
2. there is a function which outputs the contents of a variable to the journal (the variable is declared globally). When calling this function from OnCalculate we get the expected value, when calling the same function from OnChartEvent we get nonsense.
Good day!
I have faced a problem when using events, particularly the OnChartEvent() function in an indicator. When using it in an Expert Advisor, there is no problem, but in the indicator it does not work correctly. I.e. the event occurs but there is no way to change the existing fields. Example:
//----------------------------------------------------------------------------------------------
int k;
int OnInit()
{
k = 0;
ihandleDE = iCustom(_Symbol, _Period, "DrawExtremums");
//< ... >
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
Print("OnCalculate(): k =", k);
//< ... >
return(rates_total)
}
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
string nameEv = "EXTR_UP";
if (sparam == nameEv)
{
Print("OnChartEvent(): k = ", k);
k++;
}
}
//----------------------------------------------------------------------------------------------
As a result we get:
"OnCalculate(): k = 0" - always.
"OnChartEvent(): k = 0,...,123332" - counts from 0 to ...
How can this be and why!? Is there any way to fix it? If anyone understands, an answer would be very much appreciated.
P.S.: This injustice occurs only in strategy tester, in real time everything works fine.
Good day!
I have faced a problem when using events, particularly the OnChartEvent() function in an indicator. When using it in an Expert Advisor, there is no problem, but in the indicator it does not work correctly. I.e. the event occurs but there is no way to change the existing fields. Example:
//----------------------------------------------------------------------------------------------
int k;
int OnInit()
{
k = 0;
ihandleDE = iCustom(_Symbol, _Period, "DrawExtremums");
//< ... >
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
Print("OnCalculate(): k =", k);
//< ... >
return(rates_total)
}
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
string nameEv = "EXTR_UP";
if (sparam == nameEv)
{
Print("OnChartEvent(): k = ", k);
k++;
}
}
//----------------------------------------------------------------------------------------------
As a result we get:
"OnCalculate(): k = 0" - always.
"OnChartEvent(): k = 0,...,123332" - counts from 0 to ...
How can this be and why!? Is there any way to fix it? If anyone understands, an answer would be very much appreciated.
P.S.: This injustice occurs only in strategy tester, in real time everything works fine.
Good evening. At their time, Service Desk gave quite a definite answer on this subject: the terminal and the strategy tester are two different programs, and the work of Expert Advisors/indicators in the tester and in the terminal can differ significantly. What often works in the client terminal does not work in the Strategy Tester. Please write to Service Desk and provide them with proofs and let them fix it.