DomGilberto: I can't believe I am making these rookies errors... Annoys me! Yeah, I got it printing now and selecting the order. This is the code that is working in terms of the print - the lots are still not being closed out though? I have also pasted the journal messages below.
2013.07.31 11:13:522013.02.01 16:00 trendfishing_play_ground EURUSD,H1: Order Select returned the error of 0 // Not sure what is going on here?
(facepalm - I obviously need a break from it!) ok sorted that and it's now selecting the order. This is the journal print now - "Close_Half_Order" error = 0? Thats the actual OrderClose function failing. It has nothing to do with the number of "000" after the second decimal place on the "lots to close is" part, is it?
2013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: Close_Half_Order Last Error = 02013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: Order Lots Open = 0.182013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: Order Ticker Number = 92013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: The Lots to close is: 0.090002013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: The Lotstep is: 0.010002013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: The minimum lots are: 0.010002013.07.3111:28:492013.02.0115:00 trendfishing_play_ground EURUSD,H1: FirstTarget_Buy: 1.37931
(facepalm - I obviously need a break from it!) ok sorted that and it's now selecting the order. This is the journal print now - "Close_Half_Order" error = 0? Thats the actual OrderClose function failing. It has nothing to do with the number of "000" after the second decimal place on the "lots to close is" part, is it?
Braces, braces, braces . . . sometimes you need to use them, sometimes you don't.
The OrderClose() didn't fail . . .
if(OrderMagicNumber()==MagicNumber)
if(OrderSymbol()==Symbol())
if(OrderType()==OP_BUY)
if(OpenOrdersThisPair(Symbol())==1) // if this is true . . .bool Close_Half_Order = OrderClose(OrderTicket(),half,FirstTarget_Buy,3,CLR_NONE); // . . . do this.if(Close_Half_Order!=TRUE)Print("Close_Half_Order Last Error = ", GetLastError()); // do this whatever happens . . .
so if the OrderType() is not an OP_BUY the last line will still be executed, hence the error 0 . . . add braces like this:
if(OrderMagicNumber() == MagicNumber)
if(OrderSymbol() == Symbol())
if(OrderType() == OP_BUY)
if(OpenOrdersThisPair(Symbol()) == 1)
{
bool Close_Half_Order = OrderClose(OrderTicket(), half, FirstTarget_Buy, 3, CLR_NONE);
if(Close_Half_Order != TRUE) Print("Close_Half_Order Last Error = ", GetLastError() ); // only executed if the OrderClose() was also executed
}
I put in a pending order "OP_BUYSTOP" but I was under the impression that this would change when triggered to an "OP_BUY"?
I thought the order type would be "OP_BUY" if it had been triggered?
Afterall, I am only interested ONCE the order has been triggered?
Why are those braces confusing? Do you mean in terms of where the left parenthesis is? If so, it seems that is an individual thing, as I have been corrected on this multiple times?
I can't believe I am making these rookies errors... Annoys me! Yeah, I got it printing now and selecting the order. This is the code that is working in terms of the print - the lots are still not being closed out though? I have also pasted the journal messages below.
2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: Order Select returned the error of 0 // Not sure what is going on here?
c is a POSITION not a ticket number . . .
(facepalm - I obviously need a break from it!) ok sorted that and it's now selecting the order. This is the journal print now - "Close_Half_Order" error = 0? Thats the actual OrderClose function failing. It has nothing to do with the number of "000" after the second decimal place on the "lots to close is" part, is it?
(facepalm - I obviously need a break from it!) ok sorted that and it's now selecting the order. This is the journal print now - "Close_Half_Order" error = 0? Thats the actual OrderClose function failing. It has nothing to do with the number of "000" after the second decimal place on the "lots to close is" part, is it?
Braces, braces, braces . . . sometimes you need to use them, sometimes you don't.
The OrderClose() didn't fail . . .
so if the OrderType() is not an OP_BUY the last line will still be executed, hence the error 0 . . . add braces like this:
Hmmm, still does not want to close @ "Close_Half_Order" ? Not getting any error message either?
OP_BUY?
By the way, these braces do nothing other than confusing the situation . . .
I put in a pending order "OP_BUYSTOP" but I was under the impression that this would change when triggered to an "OP_BUY"?
I thought the order type would be "OP_BUY" if it had been triggered?
Afterall, I am only interested ONCE the order has been triggered?
Why are those braces confusing? Do you mean in terms of where the left parenthesis is? If so, it seems that is an individual thing, as I have been corrected on this multiple times?