Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 582
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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!