Skip to content

Replay Mode - CurrentDay FixedProfile IndicatorCandle is not "realtime" #171

@pcg-trend

Description

@pcg-trend

Making a FixedProfileRequest from a ChartStrategy in replay mode with FixedProfilePeriods.CurrentDay does not behave as expected, even with the BaseTime property set.

For example:

private async void RequestCurrentDayFixedProfile()
    {
        try
        {
            var req = new FixedProfileRequest(FixedProfilePeriods.CurrentDay,
                GetETHSessionId(),
                GetCandle(CurrentBar - 1).LastTime);

            Log.CommonChartStrategy.Warn($"Requesting current day fixed profile with base: {req.BaseTime}");

            _currentDayFixedProfile = await RequestFixedProfileAsync(req);
            
            _confluenceData.DailyMarketProfile = _currentDayFixedProfile?.Original;
        }
        catch (Exception e)
        {
            Log.CommonChartStrategy.Error($"Failed to request current day fixed profile: {e}");
        }
    }

The docs here state the following for BaseTime:

Gets the base time for period calculation. If null, the current market time is used. This is useful for Market Replay scenarios where the period should be calculated relative to a specific point in time rather than the current market time.

It's to be expected then that making a request in replay mode with the BaseTime property set will return an IndicatorCandle that reflects the "current" time within the backtesting window. It should not be displaying the EOD data for the fixed profile.

Below is a screenshot of a custom ChartStrategy logging output:

Image

Here is what the MarketProfile indicator for the Daily timeframe on the chart looks like:

Image

You can see the deviation between the two, where one shows the future EOD values (not helpful in backtesting) and the other displays the value from that particular point in time historically.

Is this a known limitation of replay mode, or must the request be formatted in a particular way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions