Broke my brain as to why the following algorithm doesn't work. It does not pass an array into the function. At first I was searching for the reason, but I managed to locate it in this test example.
Reports: "Cannot find 'functest' in 'TestLib.ex4' " then "unresolved import function call."
Contents of the Test.mq4 file
#property strict #include <TestLibx.mqh>
int mass [5];
int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { }
void OnTick() { (mass); int c=0; for (c=0;c<5;c++) Print (" mass[",c,"]=",mass[c]," "); Sleep(2000); }
Contents of the TestLibx.mq4 library file
#property library #property strict void functest (int &massx[]) { int c=0; while (c<5) { massx[c]=MathRand(); c++; } return; } Contents of the TestLibx.mqh library file
Задавайте вопросы по техническому анализу, обсуждайте торговые системы и улучшайте свои навыки программирования торговых стратегий на языке MQL5. Общайтесь и обменивайтесь опытом на форуме с трейдерами всего мира и помогайте ответами новичкам — наше сообщество развивается вместе с вами. Дифференциальный индикатор Султонова Уважаемые...
Question: The indicator creates graphical objects(OBJ_ARROW), but some of them appear only after compilation or change of timeframe. There are no errors or warnings during compilation. In the tester, Print("Error calling ObjectCreate():",GetLastError());0, Print("Error calling ObjectCreate():",GetLastError());4200.
bij: Close the position if the current time = opening time plus 5 minutes or at the opening of a new bar if the chart period is M5.
Thank you. It got better. But now there's another problem. The tester keeps giving me 100% results. But it doesn't work like that. Many trades are opened and normally closed after the specified time according to the log. However, not all deals are profitable according to the results chart where we can see the moments of opening and closing of positions. What can be the reason for such a left 100%?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good afternoon.
Broke my brain as to why the following algorithm doesn't work. It does not pass an array into the function. At first I was searching for the reason, but I managed to locate it in this test example.
Reports: "Cannot find 'functest' in 'TestLib.ex4' " then "unresolved import function call."
Contents of the Test.mq4 file
#property strict#include <TestLibx.mqh>
int mass [5];
int OnInit() { return(INIT_SUCCEEDED); }
void OnDeinit(const int reason) { }
void OnTick()
{
(mass);
int c=0;
for (c=0;c<5;c++) Print (" mass[",c,"]=",mass[c]," ");
Sleep(2000);
}
Contents of the TestLibx.mq4 library file
#property library
#property strict
void functest (int &massx[])
{
int c=0;
while (c<5)
{
massx[c]=MathRand();
c++;
}
return;
}
Contents of the TestLibx.mqh library file
#property strict
#import "TestLibx.ex4"
void functest (int &massx[]);
#import
Attach the original files to the archive.
Please help me to understand how to pass arrays in MQL4 to the library function.
Thank you.
The difference in values is greater than 10*Point, but we need to consider whether the difference will be positive or negative.
Thank you. I want to transfer to swap points and commission. What is wrong with that?
Thank you. I want to transfer to swap points and commission. What's wrong?
Thank you.
Op, you changed your answer, I don't need to know the profit. Swap and commission, there can be more than one position.
Thank you.
Op, something you changed your answer to, I don't need to know the profit. Swap and commission.
It's just that you have dividing by lot and you need to multiply.
The principle itself showed what I use. And applying it to your code is quite simple.
It's just that you have division by lot and you need to multiply.
The principle itself showed what I use. And applying it to your code is pretty easy.
Hello!
Question: The indicator creates graphical objects(OBJ_ARROW), but some of them appear only after compilation or change of timeframe. There are no errors or warnings during compilation. In the tester, Print("Error calling ObjectCreate():",GetLastError());0, Print("Error calling ObjectCreate():",GetLastError());4200.
If you don't mind answering to a dummie!
How can the tester programmatically load quotes for a different (smaller) timeframe?
Close the position if the current time = opening time plus 5 minutes or at the opening of a new bar if the chart period is M5.
Thank you. It got better. But now there's another problem. The tester keeps giving me 100% results. But it doesn't work like that. Many trades are opened and normally closed after the specified time according to the log. However, not all deals are profitable according to the results chart where we can see the moments of opening and closing of positions. What can be the reason for such a left 100%?
Thanks to Artem too!