I'm working on a EA where we start to see if it's possible to have more then one order triggered if the same trigger happens before we change trend. The code was first made to only do one order at a time with this:
total = OrdersTotal(); //This is regular program buy or sell signalif(total < 1)
{
if(lastTradeBar!=Time[0])
{
//--------------if((BuySignal))
{
ticket=OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage,MyBuySL,MyBuyTP,EaComment+" - BuySignal",MagicNumber,0,Green);
//return(0);
}
//--------------if((SellSignal))
{
ticket=OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,MySellSL,MySellTP,EaComment+" - SellSignal",MagicNumber,0,Green);
//return(0);
}
//--------------
lastTradeBar=Time[0];
}
return(0);
}
everything works as expected when we use one order but if we start using more orders by chaning total to a varible. it dosent trigger things correctly. if MaxOrders is 1 it works as i supos to but higher then one it dosn't trigger the close function.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi.
I'm working on a EA where we start to see if it's possible to have more then one order triggered if the same trigger happens before we change trend.
The code was first made to only do one order at a time with this:
then we have Close order function.
everything works as expected when we use one order but if we start using more orders by chaning total to a varible. it dosent trigger things correctly.
if MaxOrders is 1 it works as i supos to but higher then one it dosn't trigger the close function.
With MaxOrder = 1
With MaxOrder = 2
I'm missing something simple I know but I cant figure out what.