Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
1000
End Equity
1000
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
Drawdown Recovery
0
using System;
using QuantConnect.Algorithm;
using QuantConnect.Data;
using QuantConnect.Data.Market;

namespace QuantConnect.Algorithm.CSharp
{
    public class RoundingProbeCSharp : QCAlgorithm
    {
        
        public override void Initialize()
        {
            // One-day backtest for deterministic rounding comparison only.
            SetStartDate(2024, 9, 5);
            SetEndDate(2024, 9, 5);
            SetCash(1000);
            AddForex("USDJPY", Resolution.Minute);
        }

        public override void OnData(Slice data)
        {
            // First problematic price: 
            // 2024-09-05T04:01:00Z,USDJPY,143.76,-333,Stop Market,Filled,-47872.08,""
            var rawHigh1 = 143.7605m;
            var rawHigh2 = 146.4955m;
            var insideHigh1 = Math.Round(rawHigh1, 3);
            var insideHigh2 = Math.Round(rawHigh2, 3);
            Log($"[CS_ROUND] raw_high={rawHigh1:F10} inside_high={insideHigh1:F3}");
            Log($"[CS_ROUND] raw_high={rawHigh2:F10} inside_high={insideHigh2:F3}");
            Quit();
        }
    }
}