Its working now, not sure why not work before

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
I have made a script and runs smoothly on live.
But have a problem on Strategy tester. if( this == that ) close() does not work in strategy mode
Im using the close() that came with editor
int close()
{
bool result;
double priced;
int cmd,error;
//----
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
cmd=OrderType();
//---- first order is buy or sell
if(cmd==OP_BUY || cmd==OP_SELL)
{
while(true)
{
if(cmd==OP_BUY) priced=Bid;
else priced=Ask;
result=OrderClose(OrderTicket(), OrderLots(), priced, 3,CLR_NONE);
if(result!=TRUE) { error=GetLastError(); Print("LastError = ", error); }
else error=0;
if(error==135) RefreshRates();
else break;
}
}
}
else Print( "Error when order select ", GetLastError());
//----
return(0);
}
Anybody know how I can get it to work in there?