You must compare your current price with enterprice, you donīt know what value Entry at first may have.

Try it.

Code:
if (enterPrice > Price[0]){		
	Entry = enterPrice;
	enterLong();
}



You can use NumOpenTotal and so on to filter the number of active trades.

Last edited by brax; 01/10/19 16:45.