[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 24
![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
It was already running. It didn't predict the opening signal for a long time, and the air was supplied by the same timer.
In short, Paul died.
The flag is called.
As the order opens, assign OrderIsOpened=true. When a new candle opens - ...=false, and so on.
The flag is called.
As the order opens, assign OrderIsOpened=true. When a new candle opens - ...=false, and so on.
Thank you. And how to code the opening of a new candle?
Whatever you like - it's all in your hands. For example:
- when time changes by TF size (easiest)
- when the "new" open price differs from the "old" one
by the same "flag" technology.
You're welcome.
Thank you. And how do you code the opening of a new candle?
Hello dear mql people. Here comes my first code problem.
It is a trend indicator. The task is a trend indicator with coordinates 1-th line = max of last day and the day before and 2-th line = min of last day and the day before.
It would be OK, but when you switch to a lower timeframe, the coordinate is clinging to the beginning of the day, although at the corresponding price level.... and the sense of the line is completely lost.
When creating a trendline object, the datetime parameter is to blame. I cannot think how to get to it. It is necessary to calculate the time of formation of price extrema. It appears that this information
It appears that this information is embedded in the 1-minute timeframe. How to determine the datetime when the timeframe changes so that a trend is re-drawn and coordinates are attached to bars corresponding to extrema.
Unfortunately, the search has yielded nothing on the subject. I would be grateful for advice.
I understand that the procedure of code writing itself causes difficulties.
I offer you the following way of solving this task:
The only problem is that if you launch the Expert Advisor with this code in the Strategy Tester and set PERIOD variable to PERIOD_M1, both iBarShift functions return -1, i.e. the function cannot find a bar on TF M1 with the same time in the history... I don't know why it happens.
I found out why! There was no history for M1 bars on the tested period.
I need to view the price behaviour over the entire history of the instrument by MA, but the indicator is not drawn when inserted in the chart.
What is the problem?
When compiled = 0 and 0.
By the way - MT4 terminal hangs!
Set the History and Aver_Bars input parameters to a smaller value and the terminal will stop "hanging".
What makes you think that the indicator is not drawn when attached to a chart? This is what your indicator drew when I placed it on today's chart for EUR/USD TF M1:
:D :D :D
When this error occurs (division by zero), the EA stops working. Look for a place in the code where division by zero occurs - most likely, zero is obtained as a result of calculation of some parameters.
Hello, dear forum members.
Of course, I have some questions from a newcomer. I am trying to learn mql4, since I have never developed any program before, so the questions may be very primitive. But I've never been able to do them myself.
I've decided to "mess up" with displaying volumes by drawing a line instead of a bar chart with some processing. The code should make the following sense. Starting from the second bar which is in the same direction as the previous bar (both of them are up), the volume is drawn from the second bar. As a result, I get a broken line in the indicator window, which is indeed drawn from the second bar upwards, but not in all cases for some reason. The line is interrupted because other conditions of its drawing are not defined at all, it is a thing of the future. But here myself to understand why the line is not drawn on every second bar upwards, I can not. Please help me.
Here is the code. If you have any other comments on other bugs in the code, I will be glad to help you.