ERROR CODE - CT0003 assembly must contain single algo type

Created at 09 Nov 2023, 22:31
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!
JO

jodyhelpme

Joined 02.11.2023

ERROR CODE - CT0003 assembly must contain single algo type
09 Nov 2023, 22:31


Hi 

What is this error, bellow is my first cbot and i dont know what i am doing wrong 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace Jody 
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class jody : Robot
    {
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Stop Loss (pips)", Group = "Protection", DefaultValue = 20, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", Group = "Protection", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }


        private AverageTrueRange atr;
        private MacdCrossOver macd; 
        
        protected override void OnStart()
        {
            // load indicators 
            atr = Indicators.AverageTrueRange(14, MovingAverageType.Exponential);
            macd = Indicators.MacdCrossOver(26, 12, 9);
            
        }

        protected override void OnBar() 
        {
            // Calculate trade amount 
            var PrevATR = Math.Round(atr.Result.Last(1) / Symbol.PipSize); 
            var Tradeamount = (Account.Equity * 0.02) / (1.5 * PrevATR * Symbol.PipValue);
            Tradeamount = Symbol.NormalizeVolumeInUnits(Tradeamount, RoundingMode.Down);
            
            // zero line cross example 
            
            var Histogram = macd.Histogram.Last(1);
            var prevhistogram = macd.Histogram.Last(2);
            
            if (Histogram > 0 && prevhistogram < 0)     
            {
                ExecuteMarketOrder(TradeType.Buy, SymbolName, Tradeamount, "1st trade", 1.5 * PrevATR, PrevATR);
            }
            else if (Histogram < 0 && prevhistogram > 0)
            {
                ExecuteMarketOrder(TradeType.Sell, SymbolName, Tradeamount, "1st trade", 1.5 * PrevATR, PrevATR);
            }
        }

        protected override void OnStop()
        {
            Print("bye");
        }
    }
}


@jodyhelpme
Replies

PanagiotisCharalampous
10 Nov 2023, 07:13

Hi there,

Make sure you do not have two cBots in the same project file


@PanagiotisCharalampous

Maxlondoner
12 May 2024, 15:53 ( Updated at: 13 May 2024, 05:44 )

I have the same problem, I choose a new bot, but when I give it the name for a moment everything is ok but immediately after the new name remains only in the list of bots but in the code window NEW BOT reappears and the program gives me an error... .


@Maxlondoner

PanagiotisCharalampous
13 May 2024, 06:14

RE: ERROR CODE - CT0003 assembly must contain single algo type

Maxlondoner said: 

I have the same problem, I choose a new bot, but when I give it the name for a moment everything is ok but immediately after the new name remains only in the list of bots but in the code window NEW BOT reappears and the program gives me an error... .

Hi there,

Can you record a video with the steps you are taking, demonstrating this behavior?

Best regards,

Panagiotis


@PanagiotisCharalampous

hungtrash17
30 May 2024, 13:57 ( Updated at: 31 May 2024, 05:27 )

RE: RE: ERROR CODE - CT0003 assembly must contain single algo type

PanagiotisCharalampous said: 

Maxlondoner said: 

I have the same problem, I choose a new bot, but when I give it the name for a moment everything is ok but immediately after the new name remains only in the list of bots but in the code window NEW BOT reappears and the program gives me an error... .

Hi there,

Can you record a video with the steps you are taking, demonstrating this behavior?

Best regards,

Panagiotis

I have the same error CT0003


@hungtrash17

PanagiotisCharalampous
31 May 2024, 05:29

RE: RE: RE: ERROR CODE - CT0003 assembly must contain single algo type

hungtrash17 said: 

PanagiotisCharalampous said: 

Maxlondoner said: 

I have the same problem, I choose a new bot, but when I give it the name for a moment everything is ok but immediately after the new name remains only in the list of bots but in the code window NEW BOT reappears and the program gives me an error... .

Hi there,

Can you record a video with the steps you are taking, demonstrating this behavior?

Best regards,

Panagiotis

I have the same error CT0003

Thank you. Please send us some troubleshooting info and quote the link to this discussion immediately after this happens.

Best Regards, 

Panagiotis 


 


@PanagiotisCharalampous