Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 98
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
When we have both Buy and Sell sections of the code, then, after the pending order triggers, its stop will be corrected in any price direction for some reason. And when there is only a Buy or Sell part of the code, the stop is corrected as intended, only when the price moves away from it.
So tidy up the code, there are a lot of errors there. For example, for any action with an order, it must first be selected byOrderSelect() function, this condition is not fulfilled everywhere in your code. Then, when modifying an order, those parameters that remain unchanged, should be passed in their original form, and not zeroed out.
That is, instead ofOrderModify(ticket, price, sl,0,0, Blue), we needOrderModify(ticket, price, sl,OrderTakeProfit(),OrderExpiration(), Blue).
We should not hope that the ticket is stored in memory forever, it's not true, especially when several orders are opened, and their tickets are written in the same variable. And then try to modify or delete the order by an unknown ticket.
When there are both parts of the code, both for buy and for sell, then after the pending order triggers, its stop is corrected in any price direction for some reason. And when there is only a BUY or SELL part of the code, the stop is corrected as intended, only when the price moves away from it.
For example, for any action on an order, it must first be selected withOrderSelect(), a condition that is not met everywhere.
Then, when modifying the order, those parameters that remain unchanged must be passed in their original form, not zeroed out.
That is, instead ofOrderModify(ticket, price, sl,0,0, Blue), you shouldOrderModify(ticket, price, sl,OrderTakeProfit(),OrderExpiration(), Blue).
First, make different variables for buy and sell tickets
You can't hope to keep a ticket in memory forever, it's not true, especially when multiple orders are opened and their tickets are written to the same variable. And then trying to modify or delete an order by an unknown ticket.
Thank you.
That was indeed the problem. But I did so even before I asked here, apparently I had to go to sleep.
i'm new to posting, i've been working on this for a while now.
i have a good impression that it works well but i have a problem with drawdown, what i should do if i want to drawdown less.
i have a sell trade open on the screenshot.
i'm new to posting, i've been working on this for a while now.
i have a good impression that it works well but i have a drawdown, what i should do if i want to drawdown less.
i have a sell trade open on the screenshot.
i'm new to posting, i've been working on this for a while now.
i have a good impression that it works well but i have a drawdown, what i should do if i want to drawdown less.
i have a sell trade opened on the screenshot.
Build a time machine, urgently. Come back a little earlier than the time of sale, smack yourself and instead of selling you buy :)
But seriously, the "price went up" much earlier than the time indicated by the arrow in the picture. So, the position should have been reversed, instead of waiting till the price went further up.
Or, to average where the last arrow is, if the deposit is enough. That's if the stoploss disgusts you, but otherwise - stoploss rules.
i'm new to posting, i've been working on this for a while now.
i have a good impression that it works well but i have a drawdown, what i should do if i want to drawdown less.
i have a sell trade opened on the screenshot.
2 variants:
put a stop before it turns into a trawl
or catch a loss and enjoy the moment
Vitaly Muzichenko:
.... and someone for trading, so you can use more than one cycle.Thank you.