Error in the code
            
                 04 Aug 2020, 21:24
            
                    
Hello guys, I have found some problems with my code and I can't find an answer to solve the problem. I am receiving an error warning regarding "VOID" it announces the error of "class delegate enum interface or expected struct" how can i solve this problem? thanks for the attention.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        [Parameter("Stop Loss (pips)", DefaultValue = 10, MinValue = 1)]
        public int StopLoss { get; set; }
        [Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
        public int Volume { get; set; }
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.02, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }
        [Parameter("Take_Profit", DefaultValue = 75, MinValue = 10)]
        public int TakeProfit { get; set; }
     }
    
}
        protected override void OnStart()
        {
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 3);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 6);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 12);
        }
        protected override void OnTick()
        {
            if (_rsi.Result.LastValue < 40)
                if (_rsi2.Result.LastValue < 40)
                    if (_rsi3.Result.LastValue < 40)
                        Close(TradeType.buy);
            Open(TradeType.sell);
            if (_rsi.Result.LastValue > 60)
                if (_rsi2.Result.LastValue > 60)
                    if (_rsi3.Result.LastValue > 60)
                        Close(TradeType.Sell);
            Open(TradeType.Buy);
       
}
        
        
        
        protected override void OnStop()
        {
            private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType))
                ClosePosition(position);
        }
  private void Open(TradeType tradeType)
        {
            var position = Positions.Find("SampleRSI", Symbol, tradeType);
            if (position == null)
                ExecuteMarketOrder(tradeType, Symbol, Volume, "SampleRSI");
        }
        }
    }
}


PanagiotisCharalampous
05 Aug 2020, 08:48
Hi samuel.jus.cornelio,
Your code is not structured well. Did you just copy and paste from somewhere?
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous