Misleading Laverage

Course Name: Position Sizing in Trading, Section No: 18, Unit No: 19, Unit type: Notebook

# Run TIPP
for row in range(len(risky_r)):
    # Adjust the multiplier w.r.t. to the leverage based on volatility
    adj_multiplier = m * leverage_df.iloc[row]
    multiplier["multiplicator"].iloc[row] = adj_multiplier

    # The risky asset returns will be multiplied by `m`
    levered_return = adj_multiplier * risky_r.iloc[row]

    # Update account value and append to DF
    account_value = floor + (cushion * (1 + levered_return))

    # Check if account_value exceeds max_account_value
    if (account_value > max_account_value):
        # If current account value > max account value, recalculate floor
        floor = floor_percent * account_value

        # Update max_account_value
        max_account_value = account_value
    account_history["account_history"].iloc[row] = account_value

    # Recalculate cushion
    cushion = account_value - floor

    # Update leverage and append to DF
    leverage = adj_multiplier * (cushion / account_value)
    leverage_history["leverage_history"].iloc[row] = leverage

    # Calculate capital used and append to DF
    cap_used = leverage * account_value
    capital_used["capital_used"].iloc[row] = cap_used

# Update leverage and capital based on signals only for trading days
leverage_history["leverage_history"] = leverage_history["leverage_history"] * \
    signals
capital_used["capital_used"] = capital_used["capital_used"] * \
    signals

return {
    'account_history': account_history,
    'leverage_history': leverage_history,
    'capital_used': capital_used,
    'multiplier': multiplier
}

My question is
# Update leverage and append to DF
leverage = adj_multiplier * (cushion / account_value)
leverage_history[“leverage_history”].iloc[row] = leverage

    # Calculate capital used and append to DF
    cap_used = leverage * account_value
    capital_used["capital_used"].iloc[row] = cap_used

should it be [row+1] because we are taking position according to today volatility ,

Thank you for bringing this to our attention.
Yes, there is a look ahead bias in the code, which is why we will be using [row-1] when computing ‘adj_multiplier’. We are working on making these changes from our end.