Hides the indicator name and its parameters
Hides the indicator name and its parameters
28 Nov 2020, 13:01
I need to hide from the chart the name of the indicator and its parameters, I try to use the new name in the Indicator definition but it does not change anything, any idea?
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator("Short name", IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
[Parameter("Password1", DefaultValue = "secret1")]
public string Pass1 { get; set; }
[Parameter("Password2", DefaultValue = "secret1")]
public string Pass2 { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
// Initialize and create nested indicators
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] = ...
}
}
}
Replies
Adal
29 Nov 2020, 16:54
RE:
firemyst said:
To hide the name of the indicator, you'll have to call it something different. cTrader takes the name off of whatever name you give the indicator when you create the new one in the Automate section of cTrader.
To hide the parameters, you have to do something like the following:
//Change from this [Parameter("Password1", DefaultValue = "secret1")] public string Pass1 { get; set; } [Parameter("Password2", DefaultValue = "secret1")] public string Pass2 { get; set; } //To this: //[Parameter("Password1", DefaultValue = "secret1")] public string Pass1 { get; set; } Pass1 = "secret1"; //[Parameter("Password2", DefaultValue = "secret1")] public string Pass2 { get; set; } Pass2 = "secret1";
The parameters won't show up in cTrader, but with them set to "public", anyone who's importing your calgo file can see the properties "Pass1" and "Pass2" and access them.
If you want to hide them so they can't be seen outside the class file, change them from public to private.
I think we didn't understand each other.
I want to hide parameters not from the parameter list but from the indicator chart. The proposed solution creates a class variable, which is defined during compilation time, the user cannot change it.
The second problem is hiding or changing the displayed name of the indicator. For example to display other text info in this place (top left corner).
@Adal
PanagiotisCharalampous
30 Nov 2020, 09:36
Hi Adal,
You need to remove the indicator from the chart, rename it in the Indicators list in cTrader Automate, build and then add it again.
Best Regards,
Panagiotis
@PanagiotisCharalampous
Adal
30 Nov 2020, 19:01
RE:
PanagiotisCharalampous said:
Hi Adal,
You need to remove the indicator from the chart, rename it in the Indicators list in cTrader Automate, build and then add it again.
Best Regards,
Panagiotis
How I write in the question I need to hide or present another indicator name. Is it possible?
@Adal
firemyst
01 Dec 2020, 03:49
RE: RE:
Adal said:
PanagiotisCharalampous said:
Hi Adal,
You need to remove the indicator from the chart, rename it in the Indicators list in cTrader Automate, build and then add it again.
Best Regards,
Panagiotis
How I write in the question I need to hide or present another indicator name. Is it possible?
From what @Panagiotis said, it does not seem possible. You have to have the same indicator name as it's called in the Automate section.
@Panagiotis , is it possible to have the listing of the parameters on the chart itself? See the OP's original post. It has "(secret1, secret1), NAN" across the indicator area. Can this be "hidden" somehow?
@firemyst
PanagiotisCharalampous
01 Dec 2020, 08:47
Hi firemyst,
No that is not possible.
Best Regards,
Panagiotis
@PanagiotisCharalampous
firemyst
29 Nov 2020, 10:05
To hide the name of the indicator, you'll have to call it something different. cTrader takes the name off of whatever name you give the indicator when you create the new one in the Automate section of cTrader.
To hide the parameters, you have to do something like the following:
The parameters won't show up in cTrader, but with them set to "public", anyone who's importing your calgo file can see the properties "Pass1" and "Pass2" and access them.
If you want to hide them so they can't be seen outside the class file, change them from public to private.
@firemyst