division with decimals

 

What I am attempting to do is to take the current stop loss value calculate a percentage like 5% against it to get the pinch of increase I want to apply to the current stop loss to set my next target stop loss in a trailing stop loss. Formula: NewStopLoss = CurrentStopLoss * 0.05 + CurrentStopLoss. The numbers I am getting are really insanely small or insanely large if I use a "/" instead of a "*".

   double TmpValue;  // holds the sum of the calc
   double PercValue; // converts whole number of percentage from user to a decimal value
   double Remains;   // Gets the percentage of the stoploss, a.k.a. StopValue
   
   PercValue = Percentage* 0.01;
   Remains = (StopValue*PercValue)*PipPoints;
   TmpValue = (Remains + StopValue)*PipPoints;
   return (TmpValue);

 
LEHayes:

What I am attempting to do is to take the current stop loss value calculate a percentage like 5% against it to get the pinch of increase I want to apply to the current stop loss to set my next target stop loss in a trailing stop loss. Formula: NewStopLoss = CurrentStopLoss * 0.05 + CurrentStopLoss. The numbers I am getting are really insanely small or insanely large if I use a "/" instead of a "*".

Do your calulation step by step with real values and with your calculator, that will become obvious.