Hello All,
My broker has sent me a few emails asking me to ensure trades are open for longer than 2 minutes before closing them - easy for manual trading but I'm using an EA for 95% of trades.
Does anyone know how I can code MT4 so that orders close when reaching TP but only after order has been open for more than 2 minutes?
I am using OrderSend to open orders with calculated TP inserted into this function
void EnterBuy()
{
bool bResult;
double dTP = CalTP(OP_BUY);
int iMagic = JenkinsHash(Symbol(),Period());
bResult = OrderSend(Symbol(),OP_BUY,gdLotSize,Ask,100,0,dTP,"EA Buy",iMagic,0,Green);
}
I've looked online but can only see how to close after a certain duration, but not duration and TP together.
Thanks :-)
My broker has sent me a few emails asking me to ensure trades are open for longer than 2 minutes before closing them - easy for manual trading but I'm using an EA for 95% of trades.
Does anyone know how I can code MT4 so that orders close when reaching TP but only after order has been open for more than 2 minutes?
I am using OrderSend to open orders with calculated TP inserted into this function
void EnterBuy()
{
bool bResult;
double dTP = CalTP(OP_BUY);
int iMagic = JenkinsHash(Symbol(),Period());
bResult = OrderSend(Symbol(),OP_BUY,gdLotSize,Ask,100,0,dTP,"EA Buy",iMagic,0,Green);
}
I've looked online but can only see how to close after a certain duration, but not duration and TP together.
Thanks :-)