"Interesting" bug in cAlgo
"Interesting" bug in cAlgo
10 Jun 2016, 18:05
I had this error in my algo code:
[Parameter(DefaultValue = "SomeValue")] public double MySetting{ get; set; }
So the property type (double) doesn't really match the default value (string). This thing compiles successfully, but then cTrader doesn't list it under cBots. cAlgo does list it, but doesn't allow to run it. I get that my parameter declaration is not valid, and there is probably an exception being thrown in the bowls of cTrader/cAlgo - but some sort of feedback from the GUI would be nice for this and other errors like that. I do compile my algo from Visual Studio, not cAlgo, if that matters. The best option would be to list the algo, but show it red with tooltip giving more information...
Replies
zelenij.krokodil
10 Jun 2016, 20:39
RE: RE:
moneybiz said:
zelenij.krokodil said:
I had this error in my algo code:
[Parameter(DefaultValue = "SomeValue")] public double MySetting{ get; set; }
So the property type (double) doesn't really match the default value (string). This thing compiles successfully, but then cTrader doesn't list it under cBots. cAlgo does list it, but doesn't allow to run it. I get that my parameter declaration is not valid, and there is probably an exception being thrown in the bowls of cTrader/cAlgo - but some sort of feedback from the GUI would be nice for this and other errors like that. I do compile my algo from Visual Studio, not cAlgo, if that matters. The best option would be to list the algo, but show it red with tooltip giving more information...
It's not bug of cAlgo it's your mistake to assign string to a numerical value.
I hope you don't also blame cAlgo when your bot doesn't perform well. :)
I think you misunderstood me. My code is wrong, no argument. The bug in cAlgo is not that it won't allow me to run the robot, but that it won't give me the proper feedback that there is something wrong, and what exactly is wrong! And it is important in this and similar case, because the code compiles. It took me awhile to figure out what was wrong.
@zelenij.krokodil
moneybiz
11 Jun 2016, 02:59
RE: RE: RE:
zelenij.krokodil said:
moneybiz said:
zelenij.krokodil said:
I had this error in my algo code:
[Parameter(DefaultValue = "SomeValue")] public double MySetting{ get; set; }
So the property type (double) doesn't really match the default value (string). This thing compiles successfully, but then cTrader doesn't list it under cBots. cAlgo does list it, but doesn't allow to run it. I get that my parameter declaration is not valid, and there is probably an exception being thrown in the bowls of cTrader/cAlgo - but some sort of feedback from the GUI would be nice for this and other errors like that. I do compile my algo from Visual Studio, not cAlgo, if that matters. The best option would be to list the algo, but show it red with tooltip giving more information...
It's not bug of cAlgo it's your mistake to assign string to a numerical value.
I hope you don't also blame cAlgo when your bot doesn't perform well. :)
I think you misunderstood me. My code is wrong, no argument. The bug in cAlgo is not that it won't allow me to run the robot, but that it won't give me the proper feedback that there is something wrong, and what exactly is wrong! And it is important in this and similar case, because the code compiles. It took me awhile to figure out what was wrong.
It compiles because DefaultValue is of object data type. You can put any data type you want. So it won't complain.
But on runtime it has to fire some exception, did you check the log tab, maybe there is some error info?
@moneybiz
zelenij.krokodil
11 Jun 2016, 07:55
RE: RE: RE: RE:
moneybiz said:
zelenij.krokodil said:
moneybiz said:
zelenij.krokodil said:
I had this error in my algo code:
[Parameter(DefaultValue = "SomeValue")] public double MySetting{ get; set; }
So the property type (double) doesn't really match the default value (string). This thing compiles successfully, but then cTrader doesn't list it under cBots. cAlgo does list it, but doesn't allow to run it. I get that my parameter declaration is not valid, and there is probably an exception being thrown in the bowls of cTrader/cAlgo - but some sort of feedback from the GUI would be nice for this and other errors like that. I do compile my algo from Visual Studio, not cAlgo, if that matters. The best option would be to list the algo, but show it red with tooltip giving more information...
It's not bug of cAlgo it's your mistake to assign string to a numerical value.
I hope you don't also blame cAlgo when your bot doesn't perform well. :)
I think you misunderstood me. My code is wrong, no argument. The bug in cAlgo is not that it won't allow me to run the robot, but that it won't give me the proper feedback that there is something wrong, and what exactly is wrong! And it is important in this and similar case, because the code compiles. It took me awhile to figure out what was wrong.
It compiles because DefaultValue is of object data type. You can put any data type you want. So it won't complain.
But on runtime it has to fire some exception, did you check the log tab, maybe there is some error info?
Yes, yes, I understand why it's happening! And no, there is nothing in any log, because I can't get to that stage - in cTrader the algo isn't even listed. And in cAlgo it's disabled, so I can't run it. That's why I call it a bug in cTrader/cAlgo - a bug in the GUI. I think cTrader should not hide those algos that produced an exception on initialization, but should list them in red colour with an error message.
@zelenij.krokodil
moneybiz
11 Jun 2016, 13:09
RE: RE: RE: RE: RE:
zelenij.krokodil said:
Yes, yes, I understand why it's happening! And no, there is nothing in any log, because I can't get to that stage - in cTrader the algo isn't even listed. And in cAlgo it's disabled, so I can't run it. That's why I call it a bug in cTrader/cAlgo - a bug in the GUI. I think cTrader should not hide those algos that produced an exception on initialization, but should list them in red colour with an error message.
Not listing it or disabling it is a sign of something not right on the initialization part of the bot namely parameters. Which seems enough indication to make you check the code.
But you want it to tell you exactly which part caused the error. Simply you want them to do your job for you.
Probably those attributes are processed on non UI thread and only after proper initialization of the bot each bot is assigned a log window until then it is not possible to display a visual error message.
Actually it is not a bug it is by design that way. Only it could be more informative.
@moneybiz
zelenij.krokodil
11 Jun 2016, 16:55
RE: RE: RE: RE: RE: RE:
moneybiz said:
zelenij.krokodil said:
Yes, yes, I understand why it's happening! And no, there is nothing in any log, because I can't get to that stage - in cTrader the algo isn't even listed. And in cAlgo it's disabled, so I can't run it. That's why I call it a bug in cTrader/cAlgo - a bug in the GUI. I think cTrader should not hide those algos that produced an exception on initialization, but should list them in red colour with an error message.
Not listing it or disabling it is a sign of something not right on the initialization part of the bot namely parameters. Which seems enough indication to make you check the code.
But you want it to tell you exactly which part caused the error. Simply you want them to do your job for you.
Probably those attributes are processed on non UI thread and only after proper initialization of the bot each bot is assigned a log window until then it is not possible to display a visual error message.
Actually it is not a bug it is by design that way. Only it could be more informative.
I think the GUI should be as helpful as possible when dealing with errors, even if I am the culprit. Especially when it can, as is in this case. Clearly, some exception is thrown when they try to cast object which happens to be System.String to double. It wouldn't be very difficult to a) show the algo in red and b) add the fact that an InvalidCastException was thrown - and here is the stack trace. Silently swallowing the error is not very helpful, since I don't have a clue regarding what exactly is going on.
@zelenij.krokodil
moneybiz
10 Jun 2016, 20:30
RE:
zelenij.krokodil said:
It's not bug of cAlgo it's your mistake to assign string to a numerical value.
I hope you don't also blame cAlgo when your bot doesn't perform well. :)
@moneybiz