investguy:
Hi,
Im getting the following message, and ill attach the function that closes the order also...
And the function:
You have to be sure that the position size you are trying to close is >= Min Lot and a multiple of Lot Step
What is reporting the error ? OrderCloseReliable ? is it doing it correctly ?
RaptorUK: You have to be sure that the position size you are trying to close is >= Min Lot and a multiple of Lot Step
- The amount trying to close is >= min lot and I think the amount remaining must also be >= min lot.
- investguy:After you close 0.11 out of 0.14 the remaining will be 0.03. What is minlot?
2013.11.28 05:49:52 2012.12.21 12:40 Yoda GRInD v1.2 EURUSD,M1: OrderTicket() = 13 CloseBuyLot = 0.11 2013.11.28 05:49:49 2012.12.21 12:10 Yoda GRInD v1.2 EURUSD,M1: open #13 buy 0.14 EURUSD at 1.32171 ok
- You are using NormalizeDouble(..., LotDigits) This assumes that lotStep is a multiple of 10 (0.1/0.01) and fails for any other. Do it right.
WHRoeder:
Actually . . that would make a huge chunk of sense.
- The amount trying to close is >= min lot and I think the amount remaining must also be >= min lot.
I have found the problem but still cant understand the reason for the problem.
Here is the problem.. In this part:
SmartEPBuy(); if (SumOfSell > 2) CloseSellLot = OrderLots();
OrderLots() assume a completely different value to the one previously selected by OrderSelect.
Here is SmartEPBuy:
void SmartEPBuy(){ double TotalLot = 0; SumOfSell = 0; for (int e = OrdersTotal(); e >= 0 ; e--) { if ( OrderSelect(e,SELECT_BY_POS, MODE_TRADES) && OrderSymbol()==Symbol() && ((OrderMagicNumber()==Magic ) || (OrderMagicNumber()==Magic +4 )) ){ if(OrderType()==OP_SELL){ TotalLot = OrderLots() + TotalLot; SumOfSell++; } } } TotalLotS = TotalLot ; if (TotalLot >= EPTotalLotMult*LotsOptimized()) { //(TotalLot >= ((EPTotalLotMult-1)*LotsOptimized())) SmartEPBuy = true; EPUmbrellaBuy = TotalLot ; //return; } else { SmartEPBuy = false; EPUmbrellaBuy = 0; } }
Could it be that the OrderLots() is using the OrderSelect from inside of this function ?
Ofcouse OrderLots uses the last OrderSelect
Noted Sir! Thank You for the insights.
Very appreciated.
Oh, and just for future reference.. The simplest solution i found is to turn OrderLots() and OrderTicket() into a variable before calling my function and using the variables when calling OrderClose(....)
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
Hi,
Im getting the following message, and ill attach the function that closes the order also...
And the function: