| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Quote:
|
|
|||
|
Quote:
|
|
|||
|
My EA is basic - just needs to know if trade is there. No trailing stop or anything.
I have language like this: int trade; for(trade=OrdersTotal()-1;trade>=0;trade--) { if(OrderSelect(trade,SELECT_BY_POS,MODE_TRADES)==f alse) continue; if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=Ma gicNumber) continue; if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Ma gicNumber) if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,Slippage, Blue); }//for Will that catch previously opened trades? |
|
|||
|
The following when called will detect the number of open and pending orders.
Code:
int CountTrades()
{
int count=0;
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNumber)
{
if((OrderType()==OP_SELL) || (OrderType()==OP_SELLSTOP) || (OrderType()==OP_SELLLIMIT) ||
(OrderType()==OP_BUY) || (OrderType()==OP_BUYSTOP) || (OrderType()==OP_BUYLIMIT))
count++;
}
}//for
return(count);
}
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to open 1 trade per bar | anthonyrae | Metatrader 4 | 26 | 10-07-2007 10:27 AM |
| Using Gannswing to open trade | gee | Expert Advisors - Metatrader 4 | 1 | 02-15-2007 09:00 PM |
| how can i trade at the curren second price before the current stick reach it close ti | huaxia009 | Metatrader 4 | 2 | 05-29-2006 04:06 AM |