Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1246

 
Alexey Viktorov:

What are you typing in so many lines of code with? Here is one of my latest EAs, working with a set of securities on FORTS

As many securities will be listed in this list, so many will trade. And this EA with control of two trading timeframes, with trailing and of course with analysis, only 326 lines.

If you want to use switch, you don't have to add position opening in each variant. It is enough to specify the symbol name, type of trade operation and the

But it would be better, in my opinion, to wrap it all in a user-defined function.

Thank you. But it's not that it's intolerant, it's just that it was my first version of writing and in my opinion more versatile. You could add all sorts of analysis methods and not write in each order opening, just because it wouldn't be necessary and focus on analysis and new functions, instead of writing the same thing. I don't know how I crammed it into 300+ lines, I'm not that advanced in this language. In the end I have written everything in each function and came out with 1050 lines without taking into account everything else, like lot calculation, trailing, etc. The Expert Advisor may only open deals on 7 pairs simultaneously considering opening conditions, and that's all in principle. Then I want to write a new function and have to prescribe opening of orders again and again and again, instead of writing it once and using it. Trailing stop works all the time and modifies all open orders, but it is written once, so why not write once function to open orders and use it for any type of analysis. It's not clear to me yet.
 
Denis Diakonov:
Thank you. But it's not that intolerant, it's just that this was my first variant of writing and, in my opinion, it is more universal. We could add all kinds of analysis methods and not write an order opening in each one, just because it wouldn't be necessary and focus on analysis and new functions instead of writing the same thing. I don't know how I crammed it into 300+ lines, I'm not that advanced in this language. In the end I have written everything in each function and came out with 1050 lines without taking into account everything else, like lot calculation, trailing, etc. The Expert Advisor may only open deals on 7 pairs simultaneously considering opening conditions, and that's all in principle. Then I want to write a new function and have to prescribe opening of orders again and again and again, instead of writing it once and using it. Trailing stop works all the time and modifies all open orders, but it is written once, so why not write once function to open orders and use it for any type of analysis. It's not clear to me yet.

If you have more than one symbol in operation, the most effective option is to work with a custom function. For each symbol, in my variant, the function analyses the opening from the array and if the analysis function returns true, it calls the function to open an order. One function analyses the situation for all symbols one by one and opens orders for the symbol with a signal. It does not matter how many symbols are in the array. We have received a signal, opened an order, returned to the array of symbols, check the next one. And so on...

 
Alexey Viktorov:

If you have more than one symbol in operation, the most effective option is to work with a custom function. For each symbol, in my variant, the function analyses the opening from the array and if the analysis function returns true, it calls the function to open an order. One function analyses the situation for all symbols one by one and opens orders for the symbol with a signal. It does not matter how many symbols are in the array. We have received a signal, opened an order, returned to the array of symbols, check the next one. And so on...

This is a good option.
This way it will be even more convenient and the code is more compact, besides, the possibility to call the function of order opening will be provided for any type of market analysis added. The purpose was to find a way to not to constantly write the same code, and therefore, your proposal is worthy of attention! Thank you!
 
Denis Diakonov:
That's a good one.
This way it will be even more convenient and the code will be more compact, besides the possibility to call the order opening function will be opened for any added type of market analysis. The goal was to find a way to avoid constantly writing the same code, and therefore your suggestion is worthy of attention! Thank you!

Alexey is telling you standard stuff...

 
Artyom Trishkin:

Alexei is telling you the standard stuff...

Standard is when there is a separate code for each day. )))))

 
 
Artyom Trishkin:

Alexei is telling you the standard stuff...

Well, I'm in my third week with this language\.

Since 2008, but I'm just now trying to write something.

 

Hello @Artyom Trishkin ,

I'm having trouble solving the logic. Please help me with it? Here's a link to my thread: https://www.mql5.com/ru/forum/350570

Hope to hear from you later.

 

Calculate the median price on a given interval with a given number of approximations.

Hello There is an array of values.

The task is to write a function.

Input parameters:

- the array contains numbers of required elements to calculate the median - bufInBar[]

- array size -bufInBar[] - count

- number of median approximations - fokus

void medianaL0(const int &bufInBar[], int count, int fokus)

That is, there is a class

bufInBar[i] - используется для загрузки нужного элемента при расчете медианы 

BP[bufInBar[i]].CenaPerioda; - по этому значению рассчитывается медиана
BP[bufInBar[i]].Period; 

On output :

BP[bufInBar[i]].Mediana; 

Filled in ascending order e.g. from 0 to 10.

That is, iffokus=10 in the condition, then at the interval i<count, ten values

BP[bufInBar[i]].Mediana;

will be 1 to 10.

For example

BP[3256].Mediana=0;
BP[6256].Mediana=1;
BP[9256].Mediana=2;
...

Ready to transfer $12 from the account

 
Mikhail Toptunov:

Calculate the median price on a given interval with a given number of approximations.


Ready to transfer from the account $12

you know that for something like thishttps://www.mql5.com/ru/job

and here - if you started to do it yourself, but it didn't work out or isn't clear

Торговые приложения для MetaTrader 5 на заказ
Торговые приложения для MetaTrader 5 на заказ
  • www.mql5.com
Доработать существующий советник, чтобы он осуществлял выходы из сделок по виртуальному тейк-профиту на основе слежения за мультитаймфрейменным боллинжер бендз. Советник должен следовать за линиями боллинжера и выходить по указанному алгоритму Здравствуйте, нужно создать Программу для сравнения данных и отображения их. Данные надо будет брать с...