Set the indicator name in runtime
Set the indicator name in runtime
19 Nov 2016, 10:39
Hello
I'd like to set the indicator display name based on the parameters set by the user - i.e. if I'm implementing my RSI so I'd like to have the name set as "RSI(<Period>)" where Period is a parameter. IS there any way how it's can be done at runtime - for example in Initialize() function?
Replies
ctid256802
20 Nov 2016, 00:12
RE:
tmc. said:
Hi, the indicator name must be constant value so it's not possible to change in runtime. By default it shows indicator name and its parameters in parentheses, therefore if the Period is a parameter then it should be printed on the chart as desired.
Hm... why it "must be constant"? Just a quick example: I'm making indicator for COT Reports. As the parameter the user supplies the market code - i.e. "094532". So it's not user friendly to see the name like "COTReport(094532)" - I want to show instead something like "COTReport(British Pound)" - which I can actually can do as I have a key-value map in my indicator.
In fact inability to set the name in runtime is really a big limitation which makes indicators less user-friendly.
@ctid256802
whis.gg
20 Nov 2016, 16:10
You should ask Spotware not me. All I am just saying is the fact that the name showed on the chart must be constant value and values in parentheses are inputed paramater values.
You can print whatever you want on the chart as text object with static position.
ChartObjects.DrawText("objectName", "COTReport(British Pound)", StaticPosition.TopLeft, Colors.Black);
@whis.gg
ctid256802
20 Nov 2016, 19:17
Hi tmc,
That was the rhetorical question :)
And thank you for the tip with text object - it could be an option for me. Thanks!
@ctid256802
whis.gg
19 Nov 2016, 15:35
Hi, the indicator name must be constant value so it's not possible to change in runtime. By default it shows indicator name and its parameters in parentheses, therefore if the Period is a parameter then it should be printed on the chart as desired.
@whis.gg