I've updated the post.
For starters, try using the Integer representations and run the test again. See if that solves your problem then we'll talk about it some more. Edit: I think this has something to do with the fact that ordertype will start at 0. And orderselect will keep the last selected order in place.
For starters, try using the Integer representations and run the test again. See if that solves your problem then we'll talk about it some more.
Edit: I think this has something to do with the fact that ordertype will start at 0. And orderselect will keep the last selected order in place.
Could be . . .
Try declaring orderType as something it can't be . . . e.g.
int orderType = 10;
. . . then see what happens, if you get no messages then your order selection isn't working.
Could be . . .
Try declaring orderType as something it can't be . . . e.g.
. . . then see what happens, if you get no messages then your order selection isn't working.
It works exactly the same if I first declare: int orderType = 10;
I also tried using OrderType() always instead of declaring a variable, but there is the same problem.
I also tried to call OrderSelect(...) just before modifying the order, but no change.
Add in some Print(); statements so you can see what is going wrong . . . e.g.
if(/*OrderMagicNumber()==Magic &&*/ OrderSymbol()==Symbol()) { Print("orderType = ",orderType); if ((orderType == OP_BUY || orderType == OP_BUYSTOP)) {
. . . then take a look in the Experts tab.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm trying to code an EA and at some place in my code I've to update the stoploss of opened and pending orders. I'm displaying an alert with the informations about the order.
When I run it, I receive a message like: "Count: 2 Stoploss 1.44705 for buy order: 46450421 orderType: 1".
orderType: 1 means that order 46450421 is a OP_SELL order, which it is, but why is it triggering the test "if ((orderType == OP_BUY || orderType == OP_BUYSTOP))" instead of "if ((orderType == OP_SELL || orderType == OP_SELLSTOP))"?
Please help :-)
Daniel