[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 70
![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
Help in solving the problem. I may have already annoyed everyone here, but please help. If the flag on the previous bar is 1 it is allowed to draw the arrow down. After it is drawn, we set a new flag equal to -1. In the other side on the contrary. But what I do wrong. No arrows without comments. All arrows with comments.
I don't know. Sergeev knows, he said it seems to be right. I would also like to see how to write it correctly.
I just corrected it a little, so that it would show something.
- I put the indicator in a separate window, then you can put it back
- macd[] array was hanging in the air, made it an indicator, increased accuracy
- locked your complex condition for the opening, put a simple one for adjustment
- changed the condition for the flag, at least it works.
Then you can gradually introduce conditions, you will immediately see where the bug is.
HELP! Please tell me, if I close part of a position (eg order for 1 lot, and close 0.5 lot) OrderClose ticket should change? My tester says it does... How to avoid it? Below is a piece of closing code...
There is no way to avoid it. This is the DC changing the ticket. You are essentially reopening a position with a different volume, hence the new ticket. Therefore, keep your own orders record and after partial closing of a position, memorize its new ticket for further work. You can also provide some kind of identification of partially closed positions for correct further monitoring by the Expert Advisor.
Thank you! Does the MagicNumber change?
Made a temporary drawing of flag[] buffer - it's empty, why? Where is my mistake?
your error is that flag[i+1] is not initialized.
so the comparison flag[i]==1 and flag[i]==-1 will never execute!
Thank you! Does the MagicNumber change?
Thank you! Does the MagicNumber change?
The MagicNumber does not change in this case, unless this is provided for in the EA code.
yes??? and this can be envisaged ???? please show how it can be done
your error is that flag[i+1] is not initialized.
so the comparison flag[i]==1 and flag[i]==-1 will never execute!
My understanding is that I don't have initialized flag[i+1] setting. If so, where and how to do it ?
If I set 1, then when I start the indicator, it (the indicator) will wait for the change.