Hi,
I've been experimenting with the function OrderClose(). I'm using it to close half a position but I notice when half a position profit is taken the current opening trade is allocated a new order ticket. How do I find the new order ticket so I can continue to manage the trade?
The current start() function looks like this:
bool result = false;
bool stoptest = false;
string MessageAlert = "Some stuff";
double PartialTakeProfitSize = 0.01;
int ticket="64935305";
if (OrderSelect(ticket,SELECT_BY_TICKET))
if(stoptest == false)
{
result = OrderClose(ticket, PartialTakeProfitSize, MarketInfo(OrderSymbol(), MODE_BID), 5, Red);
SendMail("Stop test result"+ result, MessageAlert);
stoptest = true;
}
L
I've been experimenting with the function OrderClose(). I'm using it to close half a position but I notice when half a position profit is taken the current opening trade is allocated a new order ticket. How do I find the new order ticket so I can continue to manage the trade?
The current start() function looks like this:
bool result = false;
bool stoptest = false;
string MessageAlert = "Some stuff";
double PartialTakeProfitSize = 0.01;
int ticket="64935305";
if (OrderSelect(ticket,SELECT_BY_TICKET))
if(stoptest == false)
{
result = OrderClose(ticket, PartialTakeProfitSize, MarketInfo(OrderSymbol(), MODE_BID), 5, Red);
SendMail("Stop test result"+ result, MessageAlert);
stoptest = true;
}
L