Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 160
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
I don't want to make a new topic, I just don't understand how the EA works, maybe my elders can tell me something.
I have several indicators used in my Expert Advisor.
But in the log I can see that one of them is constantly loaded by EA, then unloaded. I don't understand this behavior.
It says uninit reason 1, what does it mean ? Other indicators are not unloaded because
I don't want to make a new topic, I just don't understand how the EA works, maybe my elders can tell me something.
I have several indicators used in my Expert Advisor.
But in the log I can see that one of them is constantly loaded by EA, then unloaded. I don't understand this behavior.
It says uninit reason 1, what does it mean ? Other indicators are not unloaded because
In this thread I want to begin to help those who really want to understand and learn programming in the new MQL4 and want to easily switch to MQL5 - the languages are very similar.
This will be a good place to discuss tasks, algorithms of their solution and any other questions, anyway, related to MT programming.
I hope that other experienced members of our forum will join us and the thread will be of interest to all.
Hello
I have such a question. How to write a code in MQL4m? For example, I need to sum up the prices and divide by the number of these prices. Consider this: 1,05000+1,06000+1,07000+1,08000:4= 1,06500
Thank you very much!
Hello
I have a question. How do I write code in MQL4? For example, I need to sum up the prices and divide by the number of these prices. For example: 1,05000+1,06000+1,07000+1,08000:4= 1,06500.
Thank you very much!
Thank you very much, Artyom!
Old age is not a joy! I forgot to tell you about the most important thing.
Let's say I have a N number of trades opened in MT4 in one direction with different prices.
How to write a code, MT4 would take these prices from a chart, add them up, divide by the number of open trades in one direction. Then add 200 pips.
The price obtained would prescribe these deals in TakeProfit.
Now I hope that's all. :)
Thank you very much!
Thank you very much, Artyom!
Old age is not a joy! I forgot to tell you about the most important thing.
Let's say I have a N number of trades opened in MT4 in one direction with different prices.
How to write a code, MT4 would take these prices from a chart, add them up, divide by the number of open trades in one direction. Then add 200 pips.
The price obtained would prescribe these deals in TakeProfit.
Now I hope that's all. :)
Thank you very much!
You need to calculate the breakeven price and add or subtract N number of points to it. Look it up, or see how to calculate breakeven
No, I do not. Why do I need to breakeven? I need to calculate the amount of open orders to give them a total Take.
you can calculate "in how many bars there will be a crossover" (just school geometry)
and the date can only be approximated from this, the bars are only formed when the market is open, i.e. they are different for each instrument.
Simplified, if you know the calendar in advance:
that is so messy, that it is a big problem in MT :-)
If you have a week week you should take it into account.
Thank you very much, Artyom!
Getting old is not a joy! I forgot to tell you about the most important thing.
Let's say I have a N number of trades opened in MT4 in one direction with different prices.
How to write a code, MT4 would take these prices from a chart, add them up, divide by the number of open trades in one direction. Then add 200 pips.
The price obtained would prescribe these deals in TakeProfit.
Now I hope that's all. :)
Thank you very much!
If you get the right type of position, you increase by 1 the size of time array and enter into it the opening price of this position.
When the loop is complete, then you will have an array with opening prices of all necessary positions.
In the loop, add up all of the values in the array, and at the end of the loop, divide the resulting value by the size of the array.
That is it - you have a calculated price. Now add the required number of points*Point() to it.
And the next interesting thing - if the obtained price turns out to be lower than the opening price of the position (Buy), it will not be a Take Profit, but a Stop Loss