The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
decimal argument = 123.456m;
int count = BitConverter.GetBytes(decimal.GetBits(argument)[3])[2];
Assert.AreEqual(3, count);
public static int ComputeSignificantDigits(decimal value)
{
// get digits before decimal place
int before;
if (value >= 1)
{
before = (int) Math.Log10((int) value) + 1;
}
else
{
before = 0;
}
// get digits after decimal place
int after = BitConverter.GetBytes(decimal.GetBits(value)[3])[2];
return after + before;
}
// can be verified with these tests:
Assert.AreEqual(0, ComputeSignificantDigits(0m));
Assert.AreEqual(1, ComputeSignificantDigits(1m));
Assert.AreEqual(2, ComputeSignificantDigits(1.0m));
Assert.AreEqual(3, ComputeSignificantDigits(123m));
Assert.AreEqual(4, ComputeSignificantDigits(12.34m));
Assert.AreEqual(5, ComputeSignificantDigits(0.01234m));
Assert.AreEqual(6, ComputeSignificantDigits(00.012345m));
Assert.AreEqual(7, ComputeSignificantDigits(01234560m));
Assert.AreEqual(8, ComputeSignificantDigits(0.00123000m));
Assert.AreEqual(9, ComputeSignificantDigits(123456789m));
// 1234567890
Assert.AreEqual(10, ComputeSignificantDigits(0.0000000000m));
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
if a trader buys 5 standard lots (i.e. 5 × 100,000 = 500,000) of EUR/USD, paying USD 650,000 and closes the position after the 10 pips' appreciation, the trader will receive USD 650,500 with a profit of USD 500 (i.e. 500,000 (5 standard lots) × 0.0010 = USD 500)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Michael H. I beleave base points ( 1/100% ) and pips are different animals... For example 1.8541 - 1.8542 = 1 pip. This is a 5 base points change.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!