Somebody know how can I fix this problem

Created at 10 Jan 2023, 23:03
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
PL

plusnagsberga

Joined 10.01.2023

Somebody know how can I fix this problem
10 Jan 2023, 23:03


using System;
using cAlgo.API;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RSIBot : Robot
    {
        [Parameter(DefaultValue = 14)]
        public int RSIPeriod { get; set; }

        [Parameter(DefaultValue = 30)]
        public int OversoldLevel { get; set; }

        [Parameter(DefaultValue = 70)]
        public int OverboughtLevel { get; set; }

        [Parameter("Take Profit", DefaultValue = 100)]
        public double TakeProfit { get; set; }

        [Parameter("Stop Loss", DefaultValue = 50)]
        public double StopLoss { get; set; }

        private RSI rsi;
        private int volume = 1;

        protected override void OnStart()
        {
            rsi = Indicators.GetIndicator<RSI>(MarketData.GetSeries(Symbol, TimeFrame.Hour), RSIPeriod);
        }

        protected override void OnTick()
        {
            var rsiValue = rsi.Result.LastValue;

            if (rsiValue < OversoldLevel)
            {
                // RSI is below oversold level, enter long position
                var position = Positions.Find(Symbol, TradeType.Buy);
                if (position == null)
                    ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "RSI", StopLoss, TakeProfit);
            }
            else if (rsiValue > OverboughtLevel)
            {
                // RSI is above overbought level, enter short position
                var position = Positions.Find(Symbol, TradeType.Sell);
                if (position == null)
                    ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "RSI", StopLoss, TakeProfit);
            }
        }
    }
}

 

Build failed (6 errors, 4 warnings)

 

Error CS0246: The type or namespace name RSI could not be found (are you missing a using directive or an assembly reference?) (C\Users\DELL OneDrive Dokumenty cAlgo Sources RobotsWew cBolNew cBotNew cBot.cs, line: 25, column: 17)

 

Error CS0246. The type or namespace name "RSI could not be found (are you missing a using directive or an assembly reference?) (C:\Users\DELLOneDrive Dokumenty.cAlgo Sources Robots New cBotNew cBotNew cBot.cs, line 30, column: 43)

 

Error CS1503. Argument 1 cannot convert from 'cAlgo API internals. Symbol' to 'string' (C\Users\DELLIOneDrive Dokumenty Algo\Sources Robots New cBot New cBotWew cBot.cs, line: 40, column: 47)

 

Error CS1503. Argument 2: cannot convert from 'cAlgo API. TradeType' to 'string' (C\Users\DELL OneDrive Dokumenty Algo Sources Robots New BotNew cBotNew cBot.cs line: 40, column:55)

 

Error CS1503 Argument 1 cannot convert from 'cAlgo API Intermals, Symbol to 'string' (C\Users\DELL OneDrive Dokumenty AlgolSources Robots New cBotWew cBot New

 

cBot.cs, line: 47, column. 47)

 

Error CS1503, Argument 2 cannot convert from 'cAlgo API TradeType' to 'string' (C\Users\DELL OneDrive Dokumenty.cAlgo Sources Robots New BotNew cBotWew cBot.cs. line 47, column: 55)

 

Warning CS0618 MarketData GetSeries(Symbol, TimeFrame) is obsolete Use GetSenes(string symbolName, Time Frame timeFrame) instead (C\Users\DELLOneDrive DokumentyicAlgolSources Robots New BotNew cBot New.cBot cs, line 30, column: 48)

 

Warning CS0612 IndicatorsAccessor Cetindicator<Tindicator (MarketSeries, params object) is obsolete (C Lisers DELL OneDrive Dokumenty cAlgolSources Robots New Bot Wew BoNew eBot cs. Ime 30 column 19)

 

Warning CS0618 Robot ExecuteMarketOrder Trade Type Symbol, long string, double?, double?y is obsolete Parameter Symbol symbol was replaced with string symbol Name More details here titips.trader.com/forum/announcements/15547 (C Users DELL'OneDrive Dokumenty Algo Sources Robots New BotNewcoNew Botes. Line 42 column, 21)

 

Warning CS0618 Rebol ExecuteMarketOrder(TradeType Symbol long, string double?, double?) is obsolete Parameter "Symbol symbol was replaced with string symbolName. More details here https://ctrader.com/forum/announcements/15847 (CWUsers\DELL OneDrive DokumentylcAlgoSources Robots New BotWew BotNewcas line: 49 column 211


@plusnagsberga
Replies

PanagiotisChar
11 Jan 2023, 11:26

Hi there,

There are several errors there which are self descriptive. Did you just copy paste the code from somewhere?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

plusnagsberga
11 Jan 2023, 19:14

RE:

PanagiotisChar said:

Hi there,

There are several errors there which are self descriptive. Did you just copy paste the code from somewhere?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Yes, I copied that from chat GPT but I don't understand for example why RSI could not be found when I am using cAlgo.Indicators.


@plusnagsberga

Shares4UsDevelopment
13 Apr 2024, 11:07 ( Updated at: 14 Apr 2024, 08:02 )

RE: RE:

plusnagsberga said: 

PanagiotisChar said:

Hi there,

There are several errors there which are self descriptive. Did you just copy paste the code from somewhere?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Yes, I copied that from chat GPT but I don't understand for example why RSI could not be found when I am using cAlgo.Indicators.

ChatGPT sucks in programming, is does not know anything about SW versions, it messes up properties and methods; in short ChatGPT is not a programmer.
So Never rely on code from ChatGPT that might build. but ensure you understand what is written and it works the way it should.


@Shares4UsDevelopment