... I tried to write myself on the basis of Euclid's algorithm, but I got confused. In general, experience is lacking ...
... The algorithm itself is not complicated. It is simple to calculate on a sheet of paper or a calculator, but I can't translate it into MQL5 language!
Based on my practice of communication on the Forum, I can tell you that if you show the code you have already written, then you will be answered faster and they will tell you where the error is in the code.
Based on my practice of communicating on the Forum, I can tell you that if you show the code you have already written at once, they will answer you faster and tell you where the error is in the code.
Regards, Vladimir.
Ok, thank you very much for your opinion. Let's try it. A brief background for understanding. I plan to use the function in an indicator based on Renko, superimposed on the main chart. There is a need to determine the current size of bricks. ZigZag is built on the basis of Renko chart, it has, among other things, two arrays - one with tops and one with bottoms. Now I need to determine the GreatestCommonDivider of the distances between them to adjust the size of the bricks automatically.
At the moment I've sketched out this kind of krakozabra and that's it, I'm stumped, I can't think of what to do next.
This is of course just a draft, do not judge strictly. I think I went somewhere wrong, it's all kind of messy, I need to find a simpler and clearer solution, but I can't get it into my head yet.....
Sergey Voytsekhovsky #: This is of course just a draft, do not judge strictly. I think I've gone somewhere wrong, it's all kind of messy, I need to find a simpler and clearer solution, but I can't think of it yet....
Sergey, form an array of numbers for which you want to find the NOD and pass it to the ArrayGcd() function from my previous post.
But I'm not sure that you will be able to use NOD in this case. It looks like you want to calculate it for numbers that don't have any rigid relations between them, ensuring the presence of a non-trivial common divisor.
Then with high probability you will always get NOD = 1.
Yuriy Bykov #: Sergey, form an array of numbers for which you want to find the NOD and pass it to the ArrayGcd() function from my previous post.
But I'm not sure that you will be able to use the NOD in this case. It looks like you want to calculate it for numbers that don't have any rigid relations between them, providing the presence of a non-trivial common divisor.
Then with high probability you will always get NOD = 1.
Perhaps you need to check, and that's only after coding the algorithm. Thanks for your feedback.
Hi all, can you tell me if it is possible to import a function from one EA to another?
For example, there is an EA that opens orders, and there is an EA that monitors the state of the account, where the parameters drawdown, etc. are specified,
I need that when the drawdown of the second EA is reached, the first EA does not open orders....
psihodelit import a function from one EA to another?
For example, there is an EA that opens orders, and there is an EA that monitors the state of the account, where the parameters drawdown, etc. are specified,
I need that when the drawdown of the second advisor is reached, the first advisor does not open orders....
How to do it for example?
If the first EA opens positions with a certain medzhik, then you can sort these positions in it or in another EA and calculate their total profit loss. And the second Expert Advisor you have counts this profit-loss, so it can not be a drawdown, it does not open positions, it monitors the state of positions with the desired medzhik. And in general, positions, after they are opened, are on their own, and among them you usually need to find the right ones)))))
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.
Sergey Voytsekhovsky #:
... I tried to write myself on the basis of Euclid's algorithm, but I got confused. In general, experience is lacking ...
... The algorithm itself is not complicated. It is simple to calculate on a sheet of paper or a calculator, but I can't translate it into MQL5 language!
Based on my practice of communication on the Forum, I can tell you that if you show the code you have already written, then you will be answered faster and they will tell you where the error is in the code.
Regards, Vladimir.
Based on my practice of communicating on the Forum, I can tell you that if you show the code you have already written at once, they will answer you faster and tell you where the error is in the code.
Regards, Vladimir.
Ok, thank you very much for your opinion. Let's try it. A brief background for understanding. I plan to use the function in an indicator based on Renko, superimposed on the main chart. There is a need to determine the current size of bricks. ZigZag is built on the basis of Renko chart, it has, among other things, two arrays - one with tops and one with bottoms. Now I need to determine the GreatestCommonDivider of the distances between them to adjust the size of the bricks automatically.
At the moment I've sketched out this kind of krakozabra and that's it, I'm stumped, I can't think of what to do next.
This is of course just a draft, do not judge strictly. I think I've gone somewhere wrong, it's all kind of messy, I need to find a simpler and clearer solution, but I can't think of it yet....
Sergey, form an array of numbers for which you want to find the NOD and pass it to the ArrayGcd() function from my previous post.
Thanks, I saw your message after I had sent my last one, now I'm trying to adapt it.
Thanks, I saw your message after I had sent my last one, now I'm trying to adapt it.
Sergey, form an array of numbers for which you want to find the NOD and pass it to the ArrayGcd() function from my previous post.
Perhaps you need to check, and that's only after coding the algorithm. Thanks for your feedback.
Hi all, can you tell me if it is possible to import a function from one EA to another?
For example, there is an EA that opens orders, and there is an EA that monitors the state of the account, where the parameters drawdown, etc. are specified,
I need that when the drawdown of the second EA is reached, the first EA does not open orders....
How to do it for example?
For example, there is an EA that opens orders, and there is an EA that monitors the state of the account, where the parameters drawdown, etc. are specified,
I need that when the drawdown of the second advisor is reached, the first advisor does not open orders....
How to do it for example?
If the first EA opens positions with a certain medzhik, then you can sort these positions in it or in another EA and calculate their total profit loss. And the second Expert Advisor you have counts this profit-loss, so it can not be a drawdown, it does not open positions, it monitors the state of positions with the desired medzhik. And in general, positions, after they are opened, are on their own, and among them you usually need to find the right ones)))))