mehdi khoshbakhtvash:
hi my firends
how do close only remaing order after closeBy Buy and sell orders
I want code it in mql4
I hope this link below could help:
https://www.mql5.com/en/search#!keyword=close%20all&module=mql5_module_codebase
Mohammad Soubra:
I hope this link below could help:
https://www.mql5.com/en/search#!keyword=close%20all&module=mql5_module_codebase
thank you my firend
but I want to find and close only remaining order after CloseBy() function .
- Show us your OrderSelect loop to find the remaining order. Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
- learn
to code it, or pay (Freelance) someone to code it.
We're not going to code it for you.
We are willing to help you when you post your attempt (using SRC)
and the nature of your problem.
whroeder1:
- Show us your OrderSelect loop to find the remaining order.
- learn
to code it, or pay (Freelance) someone to code it.
We're not going to code it for you.
We are willing to help you when you post your attempt (using SRC)
and the nature of your problem.
int CloseByLastStep()
{
CheckOrders(MagicNumber);
int SellTicket , BuyTicket ;
for(int L=0;L<OrdersTotal();L++)
{
if(OrderSelect(L,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderSymbol()==Symbol() || OrderMagicNumber()==MagicNumber)
if(OrderType()==OP_SELL && OrderLots()==MaxSLot)
{
SellTicket=OrderTicket();
}
if(OrderType()==OP_BUY && OrderLots()==MaxBLot)
{
BuyTicket=OrderTicket();
}
}
if (MaxSLot>MaxBLot)
{
if(OrderCloseBy(SellTicket,BuyTicket,White))
{
for(int LSell=0;LSell<OrdersTotal();LSell++)
{
if(OrderSelect(LSell,SELECT_BY_POS,MODE_TRADES)==true)
if (StringFind(OrderComment(),IntegerToString(SellTicket),0)&&OrderType()==OP_SELL)CloseOrder(LSell,OrderLots(),Ask,Slippage,clrLime);
}
}
}
if (MaxSLot<MaxBLot)
{
if(OrderCloseBy(SellTicket,BuyTicket,White))
{
for(int LBuy=0;LBuy<OrdersTotal();LBuy++)
{
if(OrderSelect(LBuy,SELECT_BY_TICKET,MODE_TRADES)==true)
if (StringFind(OrderComment(),IntegerToString(BuyTicket),0)&&OrderType()==OP_BUY)CloseOrder(LBuy,OrderLots(),Ask,Slippage,clrLime);
}
}
}
return(1);
}
{
CheckOrders(MagicNumber);
int SellTicket , BuyTicket ;
for(int L=0;L<OrdersTotal();L++)
{
if(OrderSelect(L,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderSymbol()==Symbol() || OrderMagicNumber()==MagicNumber)
if(OrderType()==OP_SELL && OrderLots()==MaxSLot)
{
SellTicket=OrderTicket();
}
if(OrderType()==OP_BUY && OrderLots()==MaxBLot)
{
BuyTicket=OrderTicket();
}
}
if (MaxSLot>MaxBLot)
{
if(OrderCloseBy(SellTicket,BuyTicket,White))
{
for(int LSell=0;LSell<OrdersTotal();LSell++)
{
if(OrderSelect(LSell,SELECT_BY_POS,MODE_TRADES)==true)
if (StringFind(OrderComment(),IntegerToString(SellTicket),0)&&OrderType()==OP_SELL)CloseOrder(LSell,OrderLots(),Ask,Slippage,clrLime);
}
}
}
if (MaxSLot<MaxBLot)
{
if(OrderCloseBy(SellTicket,BuyTicket,White))
{
for(int LBuy=0;LBuy<OrdersTotal();LBuy++)
{
if(OrderSelect(LBuy,SELECT_BY_TICKET,MODE_TRADES)==true)
if (StringFind(OrderComment(),IntegerToString(BuyTicket),0)&&OrderType()==OP_BUY)CloseOrder(LBuy,OrderLots(),Ask,Slippage,clrLime);
}
}
}
return(1);
}
mehdi khoshbakhtvash: please help me for used this function in mql4
Buy_ID = OrderGetInteger(ORDER_POSITION_ID); |
|
thank you sir
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
hi my firends
how do close only remaing order after closeBy Buy and sell orders
I want code it in mql4