cTrader 3.7 Update Error #495654: Can not create instance.

Created at 06 Feb 2020, 21:43
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!
VertoTrading's avatar

VertoTrading

Joined 18.06.2018

cTrader 3.7 Update Error #495654: Can not create instance.
06 Feb 2020, 21:43


Hey Guys,

 

Just had an update from my broker for the 3.7 cTrader Desktop Version. I can now longer run my cBot. Gives the following error:

06/02/2020 19:40:11.004 | Error #495654: Can not create instance.

 

Is there a reason why this update has broken my cBot? I am referenceing NuGet packages like Telegram and JSON etc.


@VertoTrading
Replies

Tatsuya
07 Feb 2020, 05:58

Same problem here,Error #495654: Can not create instance and i can't run my cBot after 3.7 update.

Everytime they add something new,they break something else.

 

Edit:

Seems you can no longer add static to parameters,for me that was the reason.

Spotware,I know you guys are doing your best but debug harder,as I said above everytime you add something you also break something else,most of the time it is not a big problem but this time it is.
How can I trust and put money on something that changes its behavior once in a while without any notice?

 


@Tatsuya

PanagiotisCharalampous
07 Feb 2020, 08:01

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

Tatsuya
07 Feb 2020, 08:07

RE:

PanagiotisCharalampous said:

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 

Sure thing.

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 static double Parameter { get; set; } //Causes Can not create instance error since 3.7.

        //[Parameter(DefaultValue = 0.0)]
        //public double Parameter { get; set; } //Works fine.

        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

 


@Tatsuya

VertoTrading
07 Feb 2020, 08:23

RE:

PanagiotisCharalampous said:

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hey Panagiotis,


#region References being Used
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using HorizontalAlignment = cAlgo.API.HorizontalAlignment;
using LumenWorks.Framework.IO.Csv;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
#endregion

#region cBot Coding
namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    #region Main Body of cBot
    public class Verto : Robot, ILogger
    {
        #region Parameters
        readonly string cBotName = "Verto News Trader";
        readonly string BotVersion = " v 1.7.5";

        #region License Key
        [Parameter("Licence Key", DefaultValue = "Please Input License Key", Group = "Licence Key")]
        public static string LicenseKey { get; set; }
        //[Parameter("Enable Telegram", DefaultValue = true, Group = "Licence Key")]
        public bool EnableTelegram = true;
        public static string TeleToken = "958414613:AAG8WdNbZjfhNxXHJ7fxiaH2nuTqhwU1Lx4";
        public static string TeleChatID = "0";
        #endregion

        #region News Parameters
        [Parameter("Display News ONLY", DefaultValue = false, Group = "News Parameters")]
        public bool ShowNewsOnly { get; set; }
        [Parameter("Trade Low Event", DefaultValue = false, Group = "News Parameters")]
        public bool ShowLow { get; set; }
        [Parameter("Trade Medium Event", DefaultValue = false, Group = "News Parameters")]
        public bool ShowMedium { get; set; }
        [Parameter("Trade High Event", DefaultValue = true, Group = "News Parameters")]
        public bool ShowHigh { get; set; }
        #endregion

        #region Order Placement
        [Parameter("Placed before Event (s)", DefaultValue = 60, Group = "Order Placement", MinValue = 1)]
        public int SecondsBefore { get; set; }
        [Parameter("Expires(M)", DefaultValue = 25, Group = "Order Placement", MinValue = 1)]
        public int MinutesTimeout { get; set; }
        [Parameter("One Cancels Other", DefaultValue = true, Group = "Order Placement")]
        public bool Oco { get; set; }
        #endregion

        #region Trading Strategy
        [Parameter("Trading Strategy", DefaultValue = "Standard", Group = "Trading Strategy")]
        public TradingStrategy TradingType { get; set; }
        [Parameter("Trading Label", DefaultValue = "XXXXXX", Group = "Trading Strategy")]
        public string Label { get; set; }
        #endregion

        #region Order Settings
        [Parameter("Pips away", DefaultValue = 5, Group = "Order Settings")]
        public int PipsAway { get; set; }
        [Parameter("Take Profit", DefaultValue = 6, Group = "Order Settings")]
        public int TakeProfit { get; set; }
        [Parameter("Stop Loss", DefaultValue = 30, Group = "Order Settings")]
        public int StopLoss { get; set; }
        [Parameter("Lot Size", DefaultValue = 0.01, Group = "Order Settings", MinValue = 0.01, Step = 0.01)]
        public double LotSize { get; set; }
        #endregion

        #region Standard Trading
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "Standard Trading")]
        public bool BreakEvenStandard { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "Standard Trading", MinValue = 1)]
        public int BreakEvenPipsStandard { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "Standard Trading")]
        public int BreakEvenExtraPipsStandard { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Standard Trading")]
        public bool StandardTradeProtect { get; set; }
        #endregion

        #region Ratchet Trading
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "Ratchet Trading")]
        public bool BreakEvenRatchet { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "Ratchet Trading", MinValue = 1)]
        public int BreakEvenRatchetTrigger { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "Ratchet Trading")]
        public int BreakEvenExtraRatchetPips { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Ratchet Trading")]
        public bool RatchetTradeProtect { get; set; }
        #endregion

        #region Combination Trading
        [Parameter("1st Break-Even w/ T.S.", DefaultValue = true, Group = "Combination Trading")]
        public bool BreakEvenCombination1st { get; set; }
        [Parameter("1st Trigger (pips)", DefaultValue = 5, Group = "Combination Trading", MinValue = 1)]
        public int BreakEvenCombinationTrigger1st { get; set; }
        [Parameter("1st Above Entry (pips)", DefaultValue = 2, Group = "Combination Trading")]
        public int BreakEvenExtraCombinationPips1st { get; set; }
        [Parameter("2nd Break-Even w/ T.S.", DefaultValue = true, Group = "Combination Trading")]
        public bool BreakEvenCombination2nd { get; set; }
        [Parameter("2nd Trigger (pips)", DefaultValue = 5, Group = "Combination Trading", MinValue = 1)]
        public int BreakEvenCombinationTrigger2nd { get; set; }
        [Parameter("2nd Above Entry (pips)", DefaultValue = 2, Group = "Combination Trading")]
        public int BreakEvenExtraCombinationPips2nd { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Combination Trading")]
        public bool CombinationTradeProtect { get; set; }
        #endregion

        #region MultiTrade Trading
        [Parameter("Partial Close (%)", DefaultValue = 50, Group = "MultiTrade Trading")]
        public double MultiTradeLotClose { get; set; }
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "MultiTrade Trading")]
        public bool BreakEvenMultiTrade { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "MultiTrade Trading", MinValue = 1)]
        public int BreakEvenMultiTradeTrigger { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "MultiTrade Trading")]
        public int BreakEvenExtraMultiTradePips { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "MultiTrade Trading")]
        public bool MultiTradeTradeProtect { get; set; }
        #endregion

        #region Money Management
        [Parameter("Enabled", DefaultValue = true, Group = "Money Management")]
        public bool RiskManagement { get; set; }
        [Parameter("Risk, %", DefaultValue = 2.5, Group = "Money Management", MinValue = 0)]
        public double Risk { get; set; }
        [Parameter("Risk, $", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double MoneyRisk { get; set; }
        [Parameter("Fixed Balance", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double FixedBalance { get; set; }
        [Parameter("Use $ Instead of %", DefaultValue = false, Group = "Money Management")]
        public bool UseMoneyInsteadOfPercentage { get; set; }
        [Parameter("Use Eq Instead of Bal", DefaultValue = true, Group = "Money Management")]
        public bool UseEquityInsteadOfBalance { get; set; }
        [Parameter("Lot Digits", DefaultValue = 2, Group = "Money Management", MinValue = 0)]
        public int LotDigits { get; set; }
        #endregion

        #region Trend Trading
        [Parameter("Active", DefaultValue = false, Group = "Trend Trading")]
        public bool TrendTrade { get; set; }
        [Parameter("Source", Group = "Trend Trading")]
        public DataSeries Source { get; set; }
        [Parameter("Fast Period", DefaultValue = 6, Group = "Trend Trading")]
        public int FastPeriods { get; set; }
        [Parameter("Medium Period", DefaultValue = 25, Group = "Trend Trading")]
        public int MediumPeriods { get; set; }
        [Parameter("Slow Period", DefaultValue = 50, Group = "Trend Trading")]
        public int SlowPeriods { get; set; }
        #endregion

        #region Dynamic Order Placement
        [Parameter("Active", DefaultValue = false, Group = "Dynamic Order Placement")]
        public bool DynamicOrders { get; set; }
        [Parameter("Bars Index Lookback", DefaultValue = 6, Group = "Dynamic Order Placement")]
        public int Barlookback { get; set; }
        #endregion

        #region Trade Protection
        [Parameter("Trigger (pips)", DefaultValue = 25, Group = "Trade Protection")]
        public int ReversePositionTrigger { get; set; }
        [Parameter("Position Multiplier", DefaultValue = 5, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double ReverseMulti { get; set; }
        [Parameter("Subsenqent Multiplier", DefaultValue = 6, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double ReverseMultiMulti { get; set; }
        [Parameter("Take Profit Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TPMulti { get; set; }
        [Parameter("Subsequent Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TPMultiMulti { get; set; }
        [Parameter("Trigger Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TriggerMulti { get; set; }
        [Parameter("Subsequent Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TriggerMultiMulti { get; set; }
        #endregion

        #region Static Parameters
        private static readonly string ConsumerKey = "ck_2e21af78795b8ac4d327b5facb154a6d441a0375";
        private static readonly string SecretKey = "cs_3b1683f65584a822e7298d1efe700ed8ab2759ed";
        public int EventsToDisplay = 1;
        public int check = 0;
        public int downloadcheck = 0;
        public bool ShowPastNews = true;
        public int PastNewsLookback = 0;
        public bool UpdateEvents = true;
        public static string FileWatchPath = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Documents/cAlgo/Sources/Robots/News Downloader");
        public static string FileWatchName = "news_archive.csv";
        private SymbolWrapper _symbol;
        private List<NewsItem> _newsItems;
        private List<NewsItem> _upcomingNews = new List<NewsItem>();
        private Dictionary<DateTime, NewsGroup<NewsItem>> _groups;
        private bool first_run = true;
        private NewsItem NI;
        public bool SymbolFilter = true;
        public bool ShowTimeLeftToNews = true;
        public bool ShowTimeLeftToPlaceOrders = true;
        private bool _ordersCreated;
        public string trendmovement = "None";
        private DateTime _triggerTimeInServerTimeZone;
        private readonly bool hasTrailingStop = true;
        private ExponentialMovingAverage fastMa;
        private ExponentialMovingAverage mediumMa;
        private ExponentialMovingAverage slowMa;
        public string Comment { get; set; }
        //static ITelegramBotClient botClient;
        #endregion

        #endregion

}

If you need more, let me know and I can send you it privatelyas i woul rather not have the code made public.


@VertoTrading

VertoTrading
21 Feb 2020, 09:58

RE:

PanagiotisCharalampous said:

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 

Have you been able to fix this problem? if it is the static parameters causing the issue then this nees to be fixed!!!!! i need the static paramaters for my cBot to function properly. I am not in a position to re-write over 7000 lines of code for one error that broke my cBot after an update.


@VertoTrading

PanagiotisCharalampous
21 Feb 2020, 12:26

Hi VertoTrading,

We will reenable support for static parameters in an upcoming update.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

VertoTrading
12 Mar 2020, 09:41

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

We will reenable support for static parameters in an upcoming update.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

Thanks for the update mate. Really do appreciate it. Do you have an ETA on when this will be released to brokers?


@VertoTrading

PanagiotisCharalampous
12 Mar 2020, 09:45

Hi VertoTrading,

The fix has been released on Spotware cTrader Beta. It should be rolled out to brokers soon.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

VertoTrading
12 Mar 2020, 09:49

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

The fix has been released on Spotware cTrader Beta. It should be rolled out to brokers soon.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hey Panagiotis,

Awesome thankyou so much for keeping us all in the loop! Never going to leave cTrader as it just work so much better than all the others, plus the support here is alot more reliable!

Really appreciate all the work you and your team are doing with this software. Making it FAR superior than others!


@VertoTrading