Build list of options at runtime
Now that I have a list of options I am wondering if we could build this list at runtime?
I would like to create this list of options OnInit (or maybe at NETStrategy constructor) but I have been looking into Attributes and my feeling is that it is not possible because they are created at compile time. So... is there any other way? Any other idea?
Thanks guys for your help!
Hi dreyes,
Thanks for using NETScript. This is a good question and I'm anxious to see if this is possible. I don't think that it is possible though. The Chart Trader project--which I put aside for now because the money potential was too great in building strategies--had dynamic fields. What do I mean? I wanted to set it up so that users can add an unlimited amount of targets, so basically, at the button right, the user can click add target and a new field will show up and the window will automatically resize to fit all of the fields. This is cleaner and more professional.
I'm assuming that based on something, you want the dropdown box to update based on actions that the user conducted. So where I'm going with this, is that you can create that (dropbox that changes during runtime) with the .NET Framework, but I do admit, it is really advanced. If you considered yourself at the intermediate level or higher, then this is something you can pursue. But I'm also assuming that you really need this to work like any other indicator that asks the user for parameters from the get go.
Anyhow, hopefully we can get back answers soon
Hi dreyes. Thank you for good question. At the moment I dont see any ways to accomplish this, because everything inside an attribute must be known to the compiler at compile-time. Only way - is extending API, for example we can add possibility to specify input parameters not only by attributes, but with variables. Something like that:
this.InputVariables.Add(new InputVariable("Property1", 1, new object[] { "option1", "option1", "option2", "option2" }))); this.InputVariables.Add(new InputVariable("Property2", 1 )));
It will be very flexible. You'll be able not only change properties of input parameters, but even add/remove them in run time.
PS: As I wrote before, till the end of this year we will work much on Algostudio and API. We are going to proceed all feedback from our traders, so dont hesitate to ask questions about every difficulties/inconveniences you met, during working with our API.
Thanks for your feedback guys!
It will be very flexible. You'll be able not only change properties of input parameters, but even add/remove them in run time.
This is exactly what I was looking for. Let me explain...
Imagine you have a list of ways to enter the market, open strategies. These strategies just suggest you when to open a position.
Imagine you have a robot/EA/NETStrategy that executes those suggestions according to the selected open strategy.
With the improvement suggested you could show a dynamic list of allowed open strategies and showing/adding only the required parameters for this strategy to work.