I note you print the output of "Min_Dist". What is it?
CB
edein:
It just fails on error 130 what ever I try to do with it.
for (cnt = OrdersTotal(); cnt >= 0; cnt--) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol()) {
Order positions are just like bars, they start at zero (High[0]) You're count is off buy one.
The first OrderSelect selects an invalid position, so OrdersPerSymbol, OrderLots() may be invalid.
ticket = OrderSend(Symbol(), OP_BUY, OrderLots() * 2, Ask, 3, SL, TP);
Change to:
for (cnt = OrdersTotal()-1; cnt >= 0; cnt--) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol()) {
Also the slip of 3 is invalid on Five (5) Digit brokers.
Thank you WHRoeder, the slippage was the main culprit.
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've read the limitations on stoploss levels for opening orders and I can succesfully open orders from an EA, but I have a script which I want to drop on a chart to reverse the single existing position to opposite side and it still fails to work. Can anyone try and help me to resolve the issue ? Thank you,
It just fails on error 130 what ever I try to do with it.