In essence there is no limit it all depends on the TF that is chosen but the most I have seen is 62 on while testing using the 1 hr time frame. on 12 pairs.
2009.07.22 22:00:03 '1133682': instant order sell 0.10 GBPNZD at 2.5019 sl: 2.6263 tp: 2.3814
2009.07.22 22:00:02 Publisher: starting
2009.07.22 22:00:02 '1133682': order was opened : #5216434 sell 0.10 EURCHF at 1.51514 sl: 1.52968 tp: 1.50130
2009.07.22 22:00:02 '1133682': request in process
2009.07.22 22:00:02 '1133682': request was accepted by server
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 USDDKK opening at 5.2342 sl: 5.4022 tp: 5.0692 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 EURCAD opening at 1.5630 sl: 1.6359 tp: 1.4916 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 GBPUSD opening at 1.64921 sl: 1.59182 tp: 1.70630 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 GBPSGD opening at 2.3789 sl: 2.3274 tp: 2.4279 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order sell 0.10 SGDJPY opening at 64.91 sl: 69.36 tp: 60.55 failed [Trade context is busy]
2009.07.22 22:00:02 '1133682': instant order sell 0.10 EURCHF at 1.51514 sl: 1.52968 tp: 1.50130
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
2009.07.22 22:00:02 '1133682': order buy 0.10 CADJPY opening at 85.22 sl: 77.78 tp: 92.57 failed [Trade context is busy]
2009.07.22 22:00:02 TradeDispatcher: trade context is busy
Code:
//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+
//Check position
bool IsTrade = False;
for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = False;
if(OrderType() == OP_BUY) {
//Close
//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+
if (exit) Order = SIGNAL_CLOSEBUY;
//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+
if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop)TrailingStop = MarketInfo(Symbol(),MODE_STOPLEVEL)/dXPoint;{
if(Bid - OrderOpenPrice() > (TrailingStop*dXPoint)*Point) {
if(OrderStopLoss() < Bid - (TrailingStop*dXPoint)*Point) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - (TrailingStop*dXPoint)*Point, OrderTakeProfit(), 0, MediumSeaGreen);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
} else {
//Close
//+------------------------------------------------------------------+
//| Signal Begin(Exit Sell) |
//+------------------------------------------------------------------+
if (exit) Order = SIGNAL_CLOSESELL;
//+------------------------------------------------------------------+
//| Signal End(Exit Sell) |
//+------------------------------------------------------------------+
if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop)TrailingStop = MarketInfo(Symbol(),MODE_STOPLEVEL)/dXPoint;{
if((OrderOpenPrice() - Ask) > ( (TrailingStop*dXPoint)*Point )) {
if((OrderStopLoss() > (Ask + (TrailingStop*dXPoint)*Point)) || (OrderStopLoss() == 0)) {
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + (TrailingStop*dXPoint)*Point, OrderTakeProfit(), 0, DarkOrange);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
}
}
}
//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+
if (Buy1_1 > Buy1_2) Order = SIGNAL_BUY;
if (Sell1_1 < Sell1_2) Order = SIGNAL_SELL;
//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (UseStopLoss) StopLossLevel = Ask - StopLoss ; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid + TakeProfit ; else TakeProfitLevel = 0.0;
RefreshRates();
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue < 0);
}
else
{
if (UseStopLoss) StopLossLevel = Ask - StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid + exit ; else TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue < 0);
RefreshRates();
if(Ticket < 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}
//Sell
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (UseStopLoss) StopLossLevel = Bid + StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask - TakeProfit ; else TakeProfitLevel = 0.0;
RefreshRates();
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink < 0);
}
else
{
if (UseStopLoss) StopLossLevel = Bid + StopLoss; else StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask - exit ; else TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink < 0);
RefreshRates();
if(Ticket < 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("SELL order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
} else {
Print("Error opening SELL order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}
if (!EachTickMode) BarCount = Bars;
}