Ctrader cbot help required please

I have the code for a zone recovery hedging Cbot. However, my ctrader flags up and error code CS0115 when it tries to build the bot from new. Can someone advise how to remedy this please.

This is the code I am trying to correct;

using cAlgo.API;
using cAlgo.API.Internals;
using System;

namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ZoneRecoveryHedgingSystem : Robot
{
// Strategy Parameters
[Parameter(“Zone Width (Pips)”, DefaultValue = 30, MinValue = 1)]
public int ZoneWidth { get; set; }

    [Parameter("Take Profit Multiplier", DefaultValue = 1.5)]
    public double TakeProfitMultiplier { get; set; }

    [Parameter("Stop Loss Multiplier", DefaultValue = 2.5)]
    public double StopLossMultiplier { get; set; }

    [Parameter("Initial Lot Size", DefaultValue = 0.1)]
    public double InitialLotSize { get; set; }

    [Parameter("Lot Multiplier", DefaultValue = 2.0)]
    public double LotMultiplier { get; set; }

    [Parameter("Max Trades", DefaultValue = 5)]
    public int MaxTrades { get; set; }

    private double _currentLot;
    private int _tradeCount;
    private TradeType _lastDirection;

    /// <summary>
    /// The OnStart method is called when the bot starts running.
    /// </summary>
    protected override void OnStart()
    {
        _currentLot = InitialLotSize;
        _tradeCount = 0;
        ExecuteInitialTrade(TradeType.Buy);
    }

    private void ExecuteInitialTrade(TradeType direction)
    {
        var result = ExecuteMarketOrder(
            direction,
            SymbolName,
            Symbol.QuantityToVolumeInUnits(_currentLot),
            "ZRHS",
            (int)(ZoneWidth * StopLossMultiplier),
            (int)(ZoneWidth * TakeProfitMultiplier)
        );

        if (result.IsSuccessful)
        {
            _lastDirection = direction;
            PlaceHedgeOrder();
        }
    }

    private void PlaceHedgeOrder()
    {
        if (++_tradeCount >= MaxTrades) return;

        _currentLot *= LotMultiplier;
        var hedgeType = _lastDirection == TradeType.Buy ? TradeType.Sell : TradeType.Buy;
        var entryPrice = _lastDirection == TradeType.Buy
            ? Symbol.Bid - ZoneWidth * Symbol.PipSize
            : Symbol.Ask + ZoneWidth * Symbol.PipSize;

        PlaceStopOrder(
            hedgeType,
            SymbolName,
            Symbol.QuantityToVolumeInUnits(_currentLot),
            entryPrice,
            "ZRHS",
            (int)(ZoneWidth * StopLossMultiplier),
            (int)(ZoneWidth * TakeProfitMultiplier)
        );

        _lastDirection = hedgeType;
    }

    /// <summary>
    /// The OnPositionOpened method is called when a position is opened.
    /// </summary>
    protected override void OnPositionOpened(PositionOpenedEventArgs args)
    {
        if (args.Position.Label == "ZRHS")
            PlaceHedgeOrder();
    }

    /// <summary>
    /// The OnPositionClosed method is called when a position is closed.
    /// </summary>
    protected override void OnPositionClosed(PositionClosedEventArgs args)
    {
        if (args.Reason == PositionCloseReason.TakeProfit)
        {
            foreach (var position in Positions) ClosePosition(position);
            foreach (var order in PendingOrders) CancelPendingOrder(order);
            _currentLot = InitialLotSize;
            _tradeCount = 0;
            ExecuteInitialTrade(TradeType.Buy);
        }
    }

    /// <summary>
    /// The OnStop method is called when the bot stops running.
    /// </summary>
    protected override void OnStop()
    {
        foreach (var position in Positions) ClosePosition(position);
        foreach (var order in PendingOrders) CancelPendingOrder(order);
    }
}

}

You didn’t do OnPositionClosed and OnPositionOpened correctly.

In OnStart, you need to add “Positions.Closed += OnPositionClosed;” and the same for opened