I solved my issue by including the following lines.
var yLots = max(round(RiskAllocation/(priceClose(0)*LotAmount)),1);
var xLots = max(round((RiskAllocation/(priceClose(0)*LotAmount))*(AtrY/AtrX)),1);
I used the priceclose multiple by LotAmount, to find out the cost a lot in the account currency, i then divided my riskallocation capital by that lot value to give the current number of lots i could by them rounded to ensure i was buying whole lots. I added the max function around to ensure that i was buying at least 1 lot.
I hope my explanation helps someone in the future.