Ok, I'm not a coder, I've no school about it but ... I can't figure out why this little operation returns a NaN value!
I've this var at the beginning
// Varialbes for simulation purpose
var Simulation = false;
var FakeCapital = 0;
var PercentOfTotal = 100;
// Variables
var Capital = (engine.getBalance() / 100).toFixed(2);
var UsableBalance = Math.floor(PercentOfTotal / 100 * Capital);
var StartingBalance = UsableBalance;
if (FakeCapital > 0 && Simulation) {
Capital = FakeCapital;
UsableBalance = Math.floor(PercentOfTotal / 100 * Capital);
StartingBalance = UsableBalance;
}
So If I activate the similation var and if I want to use another capital, the script use the fakecapital to test my script.
Here all works but I think that here there's the problem, specially the UsableBalance = Math.floor(PercentOfTotal / 100 * Capital);
Because when the script run: If I don't use the simulation, all goes right If I use the simulation and the fake capital, all goes right
But if I use the simulation and I want to use the real capital, the UsableBalance var is strange, not immediately but when the script runs! I try to explain better
Let's assume that I use the simulation phase and I want to use the real capital
Your ballance is: 87.26 bits. I'll use: 87 bits for this session, as your request.
Here all ok, but this code:
if (TemporaryLoss <= 0) {
Capital += LastProfit;
UsableBalance = Math.floor((PercentOfTotal / 100) * Capital);
TemporaryLoss = 0;
}
Return this:
TemporaryLoss: 0
Capital: 87.26
LastProfit: 1.0299999999999998
PercentOfTotal: 100
Capital: 87.261.0299999999999998
Why the math return this strange number? like a concatenation of 2 numbers? Seems that the script use the var like a text and not like a numbers.
Any Idea?