
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
Without knowing the entire ea and how you're using it, we'll just be guessing as to what's wrong. Assuming that it's selecting a correct order to pass this statement.
there's no way it'll get pass:
if ((orderType == OP_BUY || orderType == OP_BUYSTOP)) {
if its Op_Sell. Unless you have this thing on multiple charts of the same Symbol.
Seeing that you're using a contentious while loop. This is probably some form of Rapid Order Maker.
My final guess. The selected order changes after the Ordertype check :)
Anything else, I suggest like Raptor that you utilize allot of print statements.
I've printed the Ticket number and it doesn't match with the OrderType().
If the selected order is of type OP_BUY, the correct if will be processed, but then in my OrderModify(...) call, I pass OrderTicket() as the first parameter, but it is the ticket of an other order.
Any idea?
Any idea?
Maybe you are trying to Modify an order that is already closed ? you aren't specifying a pool that you are Selecting your trades from . .
MODE_TRADES (default)- order selected from trading pool(opened and pending orders),MODE_HISTORY - order selected from history pool (closed and canceled order).
Maybe you are trying to Modify an order that is already closed ? you aren't specifying a pool that you are Selecting your trades from . .
MODE_TRADES (default)- order selected from trading pool(opened and pending orders),MODE_HISTORY - order selected from history pool (closed and canceled order).
I tried that too, but it didn't change anything. It seems that I've to store all the data of the selected order I want to use:
int ticket=0;
double SL = 0.0;
OrderSelect(cnt, ...);
ticket = OrderTicket();
SL = OrderStoploss();
if (OrderType() == OP_BUY) {
}
...
Why is it so? I don't understand what is wrong in my code so that OrderTicket() doesn't correspond with the same order that the OrderType() is refering to.
I've printed the Ticket number and it doesn't match with the OrderType().
If the selected order is of type OP_BUY, the correct if will be processed, but then in my OrderModify(...) call, I pass OrderTicket() as the first parameter, but it is the ticket of an other order.
orderType = OrderType()
change to
int orderType = OrderType(); and delete the original declaration.
orderType = OrderType()
change to
int orderType = OrderType(); and delete the original declaration.
OrderType is ok. It is the OrderTicket() which is not the ticket of the right order.
I would encourage you to find out what is causing your problem rather than coding around it . . .
Software engineering is all about problem solving, it's how we learn and get better. I'm on my 3rd attempt since Saturday at coding a particular problem to do with Fibs, I'm almost there . . . careful use of the Print() function helps a lot . . .
OrderType is ok. It is the OrderTicket() which is not the ticket of the right order.
int OrderType = OrderType() is not ok, one may be hiding the other (local declarations hide globals with no error.) Try
int orderType = OrderType()