|
|||||||
| 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:
PHP Code:
|
|
||||
|
here:
// Closing of Open Orders void OpenOrdClose() { int total=OrdersTotal(); for (int cnt=0;cnt<total;cnt++) { OrderSelect(total-cnt-1, SELECT_BY_POS); int mode=OrderType(); bool res = false; bool condition = false; if (OrderMagicNumber()==Magic ) condition = true; if (condition && ( mode==OP_BUY || mode==OP_SELL )) { // - BUY Orders if(mode==OP_BUY) { res = OrderClose(OrderTicket(),OrderLots(),MarketInfo(Or derSymbol(),MODE_BID),3,Yellow); if( !res ) { Print(" BUY: OrderClose failed with error #",GetLastError()); Print(" Ticket=",OrderTicket()); Sleep(3000); } } else // - SELL Orders if( mode == OP_SELL) { res = OrderClose(OrderTicket(),OrderLots(),MarketInfo(Or derSymbol(),MODE_ASK),3,White); if( !res ) { Print(" SELL: OrderClose failed with error #",GetLastError()); Print(" Ticket=",OrderTicket()); Sleep(3000); } } } } } void TotalProfit() { int total=OrdersTotal(); totalPips = 0; totalProfits = 0; for (int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS); int mode=OrderType(); bool condition = false; if ( Magic>0 && OrderMagicNumber()==Magic ) condition = true; else if ( Magic==0 ) condition = true; if (condition) { switch (mode) { case OP_BUY: totalPips += MathRound((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT)); //totalPips += MathRound((Bid-OrderOpenPrice())/Point); totalProfits += OrderProfit(); break; case OP_SELL: totalPips += MathRound((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT)); //totalPips += MathRound((OrderOpenPrice()-Ask)/Point); totalProfits += OrderProfit(); break; } } if (UseSwap) { SwapProfit(); totalProfits = totalProfits + valueswap; } } } void sidePips() { int total=OrdersTotal(); shortPips = 0; longPips = 0; for (int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS); int mode=OrderType(); bool condition = false; if ( Magic>0 && OrderMagicNumber()==Magic ) condition = true; else if ( Magic==0 ) condition = true; if (condition) { switch (mode) { case OP_BUY: longPips += MathRound((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT)); break; case OP_SELL: shortPips += MathRound((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))/MarketInfo(OrderSymbol(),MODE_POINT)); break; } } } } |
|
|||
|
Quote:
It will be more lisible if you enclose it in the "PHP" brackets, but you can also attach the mq4 file. |
|
|||
|
Here is the modified one, all modifications have "Michel" as comment so you can easily find them. I didn't try it, tell me if it works ok.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Maximum number of open trades per MT4 account | fxtrader625 | Metatrader 4 | 10 | 06-07-2007 06:59 PM |
| Controlling number of lots on the Multi Lot Scalper | rbowles | Expert Advisors - Metatrader 4 | 1 | 08-14-2006 07:59 PM |
| number of indicators | deepdrunk | Indicators - Metatrader 4 | 3 | 07-11-2006 12:34 AM |
| ANy limit to number of trades an EA can do? | shazan | Expert Advisors - Metatrader 4 | 2 | 04-15-2006 04:34 PM |