Good afternoon!
I noticed that when writing an indicator, compilation errors are not visible. Moreover, it is not even clear whether the compilation was successful. This can only be calculated from the compile time message.
Thus, when editing code, you have to wait at least a minute since the last compilation to understand whether there are compilation errors in the code.
Also, hints on built-in types and functions in the indicator editor do not work.
It would be great if programming an indicator would be as convenient as programming a strategy.
I noticed that when writing an indicator, compilation errors are not visible. Moreover, it is not even clear whether the compilation was successful. This can only be calculated from the compile time message.
Thus, when editing code, you have to wait at least a minute since the last compilation to understand whether there are compilation errors in the code.
Also, hints on built-in types and functions in the indicator editor do not work.
It would be great if programming an indicator would be as convenient as programming a strategy.
Rename
Denis, everything (IntelliSense etc.) is made easier when developing indicators in a full-fledged IDE i.e. Visual Studio.
However, I don't understand the passage on why it should take a minute (?) and why compilation errors may occur when compilation is successful.
However, I don't understand the passage on why it should take a minute (?) and why compilation errors may occur when compilation is successful.
QUOTE:
It would be great if programming an indicator would be as convenient as programming a strategy.
As a general practice, I typically first debug my local library code (and that includes indicators) as a private method in the strategy first. Once I get that running, then I move it into Visual Studio. It's simply easier and faster to make changes to the code if it's a method in the strategy.
However, once it's in Visual Studio, it stays there. The symbolic debugger VS has is the most powerful symbolic debugger I've ever used. But making changes in the VS code library requires more steps.
Eugene, hello!
Let's say I wrote some indicator code. I click the "Compile" button, at the bottom it says "Compiled successfully, 10:09". If I make a certain change within 1 minute and press the “Compile” button again, I cannot understand whether the code compiled successfully, since the inscription is still “Compiled successfully, 10:09”. Only if I wait until 10:10 am will I be able to tell if the code compiled successfully. If successful, then the message “Compiled successfully, 10:10” will appear, if not successful, then the same message “Compiled successfully, 10:09” will remain.
I don't understand why use VS if I'm completely happy with the built-in editor. At least the strategy editor. I don't understand why the indicator editor doesn't have the same capabilities. If you don’t want to improve the built-in editor, maybe it’s better to cut it out altogether?
Let's say I wrote some indicator code. I click the "Compile" button, at the bottom it says "Compiled successfully, 10:09". If I make a certain change within 1 minute and press the “Compile” button again, I cannot understand whether the code compiled successfully, since the inscription is still “Compiled successfully, 10:09”. Only if I wait until 10:10 am will I be able to tell if the code compiled successfully. If successful, then the message “Compiled successfully, 10:10” will appear, if not successful, then the same message “Compiled successfully, 10:09” will remain.
I don't understand why use VS if I'm completely happy with the built-in editor. At least the strategy editor. I don't understand why the indicator editor doesn't have the same capabilities. If you don’t want to improve the built-in editor, maybe it’s better to cut it out altogether?
QUOTE:It's easy to understand. If it didn't compile successfully, then you'd see an error.
I cannot understand whether the code compiled successfully, since the inscription is still “Compiled successfully, 10:09”.
Anyway, we're all for improving, and we can add seconds to that time.
Edit -
Are you using Build 49? It's showing seconds for me.
Presumably topic starter's region settings are set up in a way to drop the seconds part, he may have to check how to reconfigure this in Windows.
Good afternoon!
I'm sorry. This seems to be a bug related to specific types of errors. Here is an example code that causes the above behavior:
The line that causes problems is at the very end of the code.
I'm sorry. This seems to be a bug related to specific types of errors. Here is an example code that causes the above behavior:
The line that causes problems is at the very end of the code.
CODE:
using WealthLab.Core; using System; using System.Drawing; using WealthLab.Indicators; using Newtonsoft.Json.Linq; using System.IO; using System.Collections.Generic; using System.Globalization; namespace WealthLab.MyIndicators { public class MyFundamental : IndicatorBase { //parameterless constructor public MyFundamental() : base() { } //for code based construction public MyFundamental(BarHistory source, string fileName, string reportName, string parameterName) : base() { Parameters[0].Value = source; Parameters[1].Value = fileName; Parameters[2].Value = reportName; Parameters[3].Value = parameterName; Populate(); } //static Series method public static MyFundamental Series(BarHistory source, string fileName,string reportName, string parameterName) { return new MyFundamental(source,fileName,reportName,parameterName); } //name public override string Name { get { return "MyFundamental"; } } //abbreviation public override string Abbreviation { get { return "MyFundamental"; } } //description public override string HelpDescription { get { return ""; } } //price pane public override string PaneTag { get { return "MyPaneMyFundamental"; } } //default color public override WLColor DefaultColor { get { return WLColor.FromArgb(255, 255, 0, 0); } } //default plot style public override PlotStyle DefaultPlotStyle { get { return PlotStyle.Line; } } //populate public override void Populate() { List<DateTime> times = new List<DateTime>(); List<double> values = new List<double>(); string fileName =Parameters[1].AsString; var myJsonString = File.ReadAllText(fileName); dynamic myJObject = JObject.Parse(myJsonString); //string str = ""; JObject fff = JObject.Parse(myJObject.Financials[Parameters[2].AsString].quarterly.ToString()); foreach (var prop in fff.Properties()) { //str += prop.Name; DateTime parsedDate; string pattern = "yyyy-MM-dd"; DateTime.TryParseExact(prop.Name, pattern, null, DateTimeStyles.None, out parsedDate); times.Add(parsedDate); foreach (var g in prop.Children()) { //str += " " + ((JObject)g).GetValue("totalAssets") + "\n"; values.Add(Convert.ToDouble(((JObject)g).GetValue(Parameters[3].AsString))); } } BarHistory source = Parameters[0].AsBarHistory; DateTimes = source.Close.DateTimes; //modify the code below to implement your own indicator calculation for (int n = 0; n < source.Close.Count; n++) { if (n > 0) { Values[n] = Values[n - 1]; } int index =найтиБлижайшуюДатуВИстории(times,new DateTime(source.DateTimes[n].Year,source.DateTimes[n].Month,source.DateTimes[n].Day)); if (index !=-1) { Values[n] = values[index]; //Values[n] = 10000; } //Values[n] = DateTimes[n].Hour +DateTimes[n].Minute; } } int найтиБлижайшуюДатуВИстории(List<DateTime> times, DateTime time) { for (int i = 0; i <times.Count; i++) { if (times[i] <= time) { return i; } } return -1; } //generate parameters protected override void GenerateParameters() { AddParameter("Source", ParameterType.BarHistory, null); AddParameter("Имя файла", ParameterType.String, "GAZP.json"); //AddParameter("Имя отчёта", ParameterType.String, "Balance_Sheet"); //Compiles successfully AddParameter("Имя отчёта", ParameterType.String, ""); //Problem string AddParameter("Имя показателя", ParameterType.String, "totalAssets"); } } }
Eugene, please show me exactly what setting needs to be changed in order for the seconds to be shown?
I tried setting the short time format to the same as the full time format, it didn't help.
I tried setting the short time format to the same as the full time format, it didn't help.
QUOTE:
AddParameter("Имя отчёта", ParameterType.String, ""); //Problem string
Well, as you already figured out a default string value should be specified.
QUOTE:
I tried setting the short time format to the same as the full time format, it didn't help.
Nice try but I was just throwing ideas at the wall.
The Control Panel settings do not matter. The code is programmed to always display seconds.
What version of WealthLab are you using?
What version of WealthLab are you using?
Cone, I'm using build 49.
Update - but it doesn't display seconds for the Indicator Builder.
We'll change it to always display seconds there too.
We'll change it to always display seconds there too.
Your Response
Post
Edit Post
Login is required