OmegaFX : 100 (1) + 100 (2) + 100 (3) + 30 (4) = 330 (Targeted size)
From my code 82.5 (1) + 82.5 (2) + 82.5 (3) + 82.5 (4) = 330 (Targeted size)
bool OpenNew(int MN, double lotsNew){ //{string market.pair // Import from init. // string op.text // \ Import from // int op.code // > SetDIR. Possibily //}double DIR; // +/-1 // / via ModifyStops. color orderColor = IfI(color.Buy, color.Sell); // Put the magic number in #define NO_SL 0 // the "Comment" field so you can see it on the #define NO_TP 0 // Metatrader terminal. This way you can figure #define NO_EXPIRATION 0 // out what is what, as magic numbers are not // available in user-interface. --LibOrderReliable string orderComment = WindowExpertName() + " (" + MN + ")"; // If a trade size is bigger than maxlot, it must be split. for(int nSplit=MathCeil(lotsNew / market.maxLot); nSplit>0; nSplit--){ double size = NormalizeLots(lotsNew / nSplit); lotsNew -= size; if(GetTradeContext() < TC_LOCKED){ // 100.10=33.34+33.34+33.33 CallAgainOn(0,"gtc"); break; } // 99.99=50.0+49.99 double oop = Bid+bid.to.open; // Update for each openSend. int ticket = OrderSend( market.pair, op.code, size, oop, Slippage.Pips*pips2points, NO_SL, NO_TP, orderComment, MN, NO_EXPIRATION, orderColor ); if(ticket < 0){ RefreshRates(); AlertMe( "OrderSend(type=" + op.code + " (" + op.text + "), lots=" + size + ", price=", PriceToStr(oop) + " (" + DeltaToPips(oop-Bid) + "), SL=0, TP=0, '" + orderComment + "', ...) failed: ", GetLastError() ); if(!IsTradeAllowed()) AlertMe("Trading NOT allowed!"); EA.status = "OrderSend Failed "; return(false); } if(!OrderSelect(ticket,SELECT_BY_TICKET)){ int gle = GetLastError(); Print("OrderSelect(",ticket,",Ticket) failed: ", gle); Log( "OrderSelect(",ticket,",Ticket) failed: ", gle); break; } else{ static int nOrders=0; if(nOrders<20) nOrders++; double // No refresh here yet. slippage = (OrderOpenPrice() - oop)*DIR; average.slippage += (slippage - average.slippage) / nOrders; } } // for(split) return(true); } // OpenNew
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Lot per ticket is restricted to 100 lots max. for Micro account, and 50 lots max. for the standard one.
Now, suppose that I need to send order having 330 lots with Micro account upon triggered signal.
Please hint me about how to design a loop to handle repetitive OrderSend() x times till completing the targeted order size as following:
100 (1) + 100 (2) + 100 (3) + 30 (4) = 330 (Targeted size)
Which results in 4 tickets (partial ordering) at the same Ask/Bid market level.