You need to normalize double.
OrderClosePrice() should already be normalized.... But you should try it anyway, as ubzen suggested.
OrderClosePrice should already be normallized.
Where is the OrderSelect code. Is there any other server requests or sleeps - need to refreshRates()
What is Slip (has it been adjusted for 5 digit brokers)
Where is the OrderSelect code. Is there any other server requests or sleeps - need to refreshRates()
What is Slip (has it been adjusted for 5 digit brokers)
OrderClosePrice() does not need RefreshRates(). It's implied that the order was selected (otherwise it wouldn't work at all and he claims it worked with the same code in the past), but there still might be some problem with the selection, so please show us the OrderSelect() code. Slippage has nothing to do with this error.
i have experienced problems with using standard functions in orderclose
try assigning OrderClosePrice to a variable first.
ie:
OrderSelect(Myticket, by ticket, mode trades); // select order double closeprice = OrderClosePrice(); // assign close price to a variable Result = OrderClose(MyTicket, 0.1, closeprice, Slip, Blue); // close order

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When running startegy tester the EA seems to be running correctly over a lot of days but then I get:
OrderClose error 4107
invalid price 1.34216000 for OrderClose function
This is very strange as the code to close the order has not changed
Result = OrderClose(MyTicket, 0.1, OrderClosePrice(), Slip, Blue);
if (Result < 1)
{
Print("Error ", GetLastError(), " While Closing Buy Ticket ", MyTicket,
" Lots = ", OrderLots(), " Price = ", OrderClosePrice(), " Ask = ", Ask);
return(0);
}
I assume there is a corruption in the history file but clearing the file and downloading it again gives the same problem.
I go to tools history centre - delete the file EURUSD 1 Minute (M1) - then downlosd it again - and it gives the same error every time at the same place
Changing to different testing dates gives a similar error - this time a 138 on a different date.
Anyone have any ideas?