Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 413

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 understand that, but I can't write it down. The Expert Advisor either trades only on muwings signals and does not open a reverse position in case of a loss, or simply crashes the terminal when testing starts. So I wrote something that cannot be processed at all. I am at a loss with writing. I need help in the form of written code.
If OrderProfit()<0, it will open opposite order.But it does not work together with signals from moving aids. Can you write a single code to provide both muwings signals and conditions for opening an opposite position?
And just in case, the quotes would be updated before placing the order to avoid errors and further failures
RefreshRates()
I understand that, but I can't write it down. The Expert Advisor either trades only on muwings signals and does not open a reverse position in case of a loss, or simply crashes the terminal when testing starts. So I wrote something that cannot be processed at all. I am not very good at writing. I need help in the form of written code.
If OrderProfit()<0, it will open opposite order.But it does not work together with signals from moving aids. Can you write a single code that contains both muwings signals and conditions for opening an opposite position?
Thought is racing! But experience shows that what we think (as it should be) and what is actually there are very often DIFFERENT things. What can be advised: "Preprint the whole sequence of your code execution", - that's the fastest way to find an error (or make sure you're right). :)
It seems that this is the only way, otherwise you will not understand what is the difference in stopping during testing and working on the demo.
Unfortunately, I have no time or possibility to write you a finished code as I am at work))
You do not search by history, but by current positions, here is a logical chain based on which you can try to write code:
[block of working with muwings and placing an order]
1 remember the ticket and the magic number of the placed order
2 monitor the number of orders and if there are no orders in the market (it means that our order has been closed), then go to point3 or monitor this specific order until its close time is more than zero, in which case we exclude points 3 and 4
3 find our order
4 find out if it is closed
5 find out how it was closed
6 if it was closed through a stop, set another order different from it in the direction
Thank you for your reply. I'll give it a try. Still, if you have a chance to write such a code after work, please do. I will be very grateful to you. For now I'm trying the logic of the written code, even though it's simple, and then I'm trying to do something by analogy.
If the profit of an order is less than zero, it does not mean that the order is last. The last order is the last one to close.
Thanks for the clarification.
Thank you for your reply. I'll give it a try. Still, if you have a chance to write such code after work, please do. I will be very grateful to you. For now I am trying the logic of the written code, even though it is simple, and then I will try to do something by analogy.
After work I have a rest;))) And if I write, I do it to order, not expensive;) =)
condition if ( a > c ...), then - do not perform any action (outside the market - do not buy or sell ), how to set the condition with program code ? thanks
1st option:
2nd option:
after exiting the start it will continue trading after the signal changes ?
and how is the action different ? this
and this 
after exiting the start it will continue trading after the signal changes ?
and how is the action different ? this and this
(without going into details) nothing.