What is wrong about Lot Calculator

 
input double   RiskBalancePercent = 1;
double Ask;
double Bid;
double AccountBalance;
double TickSize;
double TickValue;
double LotStep;
double TP_Calculated;
double riskpertrade;
double LotsBuy;
double LotsSell;
double RiskPerRewardRatio = 1;

      ///get price
      Ask = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), Digits());
      Bid = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID), Digits());
      AccountBalance = AccountInfoDouble(ACCOUNT_BALANCE);
      TickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
      TickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
      LotStep = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
      
      
      
          SL_Price_Line = NormalizeDouble(ObjectGetDouble(0,"SL_Line",OBJPROP_PRICE),Digits());

         if(SL_Price_Line > Bid)///Sell side
               {
                        PriceBySide = SymbolInfoDouble(_Symbol,SYMBOL_BID);
                        SL_PIP = NormalizeDouble(PriceBySide-SL_Price_Line,Digits())*10;
                        TP_Calculated = NormalizeDouble(((SL_PIP/10) * RiskPerRewardRatio) + Bid,Digits());
                        LB_LotsSize = LotsSell; 
                        
               }else if(SL_Price_Line < Ask){//Buy
                        PriceBySide = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
                        SL_PIP = NormalizeDouble(PriceBySide-SL_Price_Line,Digits())*10;
                        TP_Calculated = NormalizeDouble(((SL_PIP/10) * RiskPerRewardRatio) + Ask,Digits());
                        LB_LotsSize = LotsBuy;
            }



      
      double SL_PIP_Caled = SL_PIP;
      

      
     //Risk per trade calculation

      double ticksup = NormalizeDouble((Ask - (Ask - SL_PIP_Caled) * TickSize),Digits());
      double ticksdown = NormalizeDouble((((Bid - SL_PIP_Caled) * TickSize) + Bid),Digits());
      ////////////////////////////////////
      riskpertrade = AccountBalance * RiskBalancePercent / 100;
      double lotup0 = ticksup * TickValue * LotStep;
      double lotdown0 = ticksdown  * TickValue * LotStep;
      
      
      double lotup1 = riskpertrade/lotup0;
      double lotdown1 = riskpertrade / lotdown0;
      LotsBuy = NormalizeDouble(lotup1,Digits());
 

in the sell side the SL PIP is a negative value i think .

What are you trying to calculate ?

Lot per risk amount based on stop loss size ?

(also forget about pips use points)