Making a Order send adjust the order size so that the stop loss becomes 1% of my account?

 

Hello,

I am new to the coding world and require a bit of help from the professionals. I want to make my stop loss 1% of my account but have it at a fixed point (i.e. 3xATR) therefore, if Meta trader could adjust my order size so that the stoploss becomes 1% of my account. how would I code this into my code.

   if (signal=="BUY" && OrdersTotal()<2)
   OrderSend (NULL,OP_BUY,.10,Ask,0,(Ask-ATRLoss),(Ask+ATRProfit),NULL,0,0,Green);
   if (signal=="SELL" && OrdersTotal()<2)
   OrderSend (NULL,OP_SELL,.10,Bid,0,(Bid+ATRLoss),(Bid-ATRProfit),NULL,0,0,Red);

This is the order send part of my bot, I would like to make the lot size adjustable by a code.

thank you in advance.