in case your broker is implementing the No Hedge rule but isnt giving you a demo server with a No Hedge environment to work on, you might want to use this EA i wrote to simulate "No Hedge".
This is an EA; save it accordingly.
Just drop this single EA on ANY chart - just one single instance and it will monitor ALL currency pairs with a HEDGE and auto closes them using the Built in MT4 function OrderCloseBy.
OrderCloseBy will close matching Buy and Sell orders, closing only the common lot size, BUT you dont get to pay twice the spread cost.
ie, if current EURUSD BID ASK price is 1.3050/52; when you place a BUY and SELL, you automatically end up with 4 pips loss right? If you close both at the same time manually, you end up indeed with 4 pips loss. However, OrderCloseBy will close the BUY at 2 pips loss and the SELL with 0 loss. Therefore, the whole thing, you lose only 2 pips.
This wont work with IBFX. IBFX will not support OrderCloseBy. FXDD does.
Inserted Code
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { while (IsDemo() && IsExpertEnabled()) { bool flag = true; for (int i=0; flag && i<OrdersTotal(); i++) { if ( OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderType() == OP_BUY ) { intbuy.ticket= OrderTicket(); stringbuy.symbol= OrderSymbol(); doublebuy.lot= OrderLots(); doublebuy.price= OrderOpenPrice(); for (int j=0; flag && j<OrdersTotal(); j++) { if ( OrderSelect(j,SELECT_BY_POS,MODE_TRADES) && OrderType() == OP_SELL && OrderSymbol() == buy.symbol ) { intsell.ticket= OrderTicket(); stringsell.symbol= OrderSymbol(); doublesell.lot= OrderLots(); doublesell.price= OrderOpenPrice(); Comment("Sending OrderCloseBy Request:", "\n B ",buy.ticket, " ", DoubleToStr(buy.lot,2), " lots @", DoubleToStr(buy.price,MarketInfo(buy.symbol,MODE_DIGITS)), "\n S ",sell.ticket, " ", DoubleToStr(sell.lot,2), " lots @", DoubleToStr(sell.price,MarketInfo(sell.symbol,MODE_DIGITS)) ); bool success = OrderCloseBy(buy.ticket, sell.ticket, CLR_NONE); if (success) { Comment("HEDGE CLOSED:", "\n B ",buy.ticket, " ", DoubleToStr(buy.lot,2), " lots @", DoubleToStr(buy.price,MarketInfo(buy.symbol,MODE_DIGITS)), "\n S ",sell.ticket, " ", DoubleToStr(sell.lot,2), " lots @", DoubleToStr(sell.price,MarketInfo(sell.symbol,MODE_DIGITS)) ); } else { Print("Closeby failed! ", GetLastError() ); } flag = false; } } } } Sleep(100); } return(0); } //+------------------------------------------------------------------+
This is an EA; save it accordingly.
Just drop this single EA on ANY chart - just one single instance and it will monitor ALL currency pairs with a HEDGE and auto closes them using the Built in MT4 function OrderCloseBy.
OrderCloseBy will close matching Buy and Sell orders, closing only the common lot size, BUT you dont get to pay twice the spread cost.
ie, if current EURUSD BID ASK price is 1.3050/52; when you place a BUY and SELL, you automatically end up with 4 pips loss right? If you close both at the same time manually, you end up indeed with 4 pips loss. However, OrderCloseBy will close the BUY at 2 pips loss and the SELL with 0 loss. Therefore, the whole thing, you lose only 2 pips.
This wont work with IBFX. IBFX will not support OrderCloseBy. FXDD does.