Ahhh, okay, we just need to put two and two together here...
The percentage of increase shown in the market relates to the fixedPriceIncrease
in relation to the initialPrice
fixedPriceIncrease = initialPrice * marketPriceIncreasePct / n
Regarding uncertainties in the actual values the following points are of interest:
- for the current/initial price, the maximum accuracy is 3 digits (x.xx or xxx) and cannot be influenced,
- the measured cost can be more accurately determined using the currentMoney
before and after buying (max xxx.xxxx digits accuracy),
- the accuracy for market price increase can be accurate up to 5 digits (xxx.xx%),
- the sell value is also only known up to 3 digits (x.xx or xxx), but could be determined with more accuracy using the currentMoney
before and after selling.
I would say, the most accurate method would be to use the percentage with 5 digits, determine the cost based on the currentMoney
display (note down values before and after buying).
initialPrice = (moneyBeforeBuying - moneyAfterBuying) / [ n*(1+ marketPriceIncreasePctPerPiece*(n+1)/2) ]
fixedPriceIncrease = initialPrice * marketPriceIncreasePctPerPiece
This relies heavily on the initialPrice
and having enough cash to actually get the numbers for 5 digit pct increase in market as well as 5-7 digit current money values. In a later stage, with an unknown number of bought alloys before, the initialPrice
is not determinable anymore and the formulas in the initial post are more applicable...
Further to reduce uncertainty in gains the base sell value could be determined similarly using the currentMoney
display before and after selling. That of course is a lot of work to reduce the uncertainty below +-5%, which is the accuracy I get with the formulas of the initial post (depending on the type of alloy).