Replying to crystalmax’s comment
if(live[j]==1)
{
if(orders_array[j]>0)
if(marginclose(j,orders_array[j]-1)>MathMin(AccountFreeMargin(),cash))
if(profit(j,orders_array[j]-1)>r[j]&&profit(j,orders_array[j]-1)<trail[j]*profit_max[j])
{
while(profit(j,orders_array[j]-1)>pj]*r[j])close(j,orders_ar…