I have a multicurrency EA that operates on 27 pairs. It takes 4 trades for every trade opportunity 3 scale out and on trailer. Open orders quite often run up to 8-10 percent of the accountbalance rather fast and I like to take that
I am implementing a "Total System" type TP and SL EA that monitors the account and closes all trades if the value of total open orders is above a certain value or below a certain value.
I am using Alpari UK (five digits and a demo mico account) so I m not a victim of the FIFO rule
It seems that it works only for buy orders. When I run it I only have sell orders still open. The code is rather straight forward, I have tested variations and read several of the entries
here on the forum on the same subject. I get 2 types of error, 129 invalid price and 131 invalid trade volume. I have spent several hours going nowhere. Any help is appreciated.
You need to OrderSelect() before you can use OrderTiccket() . . .
for(pos=0;pos<total;pos++) { // <------- where is the OrderSelect() ? ? ticket = OrderTicket(); // Sleep(1000); //Does not help if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
If you are closing or deleting Orders in a loop you MUST count down: Loops and Closing or Deleting Orders
Don't call GetLastError() unless you have an error or you may be getting the wrong error number . . . . What are Function return values ? How do I use them ?
OrderClose(ticket,lots,closeprice,3,CLR_NONE); //close order int err=GetLastError(); // <--- did the OrderClose() fail ? if not where is the error ? if(err != 0) Print("Symbol: "+OrderSymbol()+ " Ticket: "+ DoubleToStr(ticket,0) + " Price: " + DoubleToStr(closeprice,5) + " Lots: "+DoubleToStr(lots,2)+ " error(",err,"): " + ErrorDescription(err) );
- 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 have a multicurrency EA that operates on 27 pairs. It takes 4 trades for every trade opportunity 3 scale out and on trailer. Open orders quite often run up to 8-10 percent of the accountbalance rather fast and I like to take that
I am implementing a "Total System" type TP and SL EA that monitors the account and closes all trades if the value of total open orders is above a certain value or below a certain value.
I am using Alpari UK (five digits and a demo mico account) so I m not a victim of the FIFO rule
It seems that it works only for buy orders. When I run it I only have sell orders still open. The code is rather straight forward, I have tested variations and read several of the entries
here on the forum on the same subject. I get 2 types of error, 129 invalid price and 131 invalid trade volume. I have spent several hours going nowhere. Any help is appreciated.
2013.11.21 23:00:47 FXCMTFunc EURNZD,H1: Symbol: AUDUSD Ticket: 170655533 Price: 0.92359 Lots: 0.10 error(129): invalid price
2013.11.21 23:00:47 FXCMTFunc EURNZD,H1: Symbol: EURGBP Ticket: 170452329 Price: 0.83227 Lots: 0.11 error(129): invalid price
2013.11.21 23:00:49 FXCMTFunc EURNZD,H1: Symbol: NZDUSD Ticket: 170599563 Price: 0.82092 Lots: 0.11 error(131): invalid trade volume
code: