Get Color Picker for parameter
Get Color Picker for parameter
09 Jun 2018, 22:48
Hi all,
I'm trying to get a color picker as parameter for my indicator. Should not be that dificult. Cannot use the enumerate Colors for some reason.
Help...
Replies
PanagiotisCharalampous
13 Jun 2018, 14:11
Hi ADFX,
It is not possible to retrieve the color of IndicatorDataSeries using cAlgo.
Best Regards,
Panagiotis Charalampous
@PanagiotisCharalampous
afhacker
13 Jun 2018, 15:01
RE:
Panagiotis Charalampous said:
Dear Trader,
Thanks for posting in our forum. This is currently not possible in cAlgo. A workaround is to get the Color as a string parameter and use the following function to convert the string to a Color
//A function for getting the color from a string private Colors GetColor(string colorString) { foreach (Colors color in Enum.GetValues(typeof(Colors))) { if (color.ToString() == colorString) return color; } return Colors.White; }Let me know if this helps,
Best Regards,
Panagiotis
Simple method:
private Colors GetColor(string colorText, string colorParameterName) { Colors color; if (!Enum.TryParse(colorText, true, out color)) { string errorObjName = string.Format("Your input for '{0}' parameter is incorrect", colorParameterName); ChartObjects.DrawText("Error", errorObjName, StaticPosition.Center, Colors.Red); // throw new ArgumentException(errorObjName); } return color; }
@afhacker
PanagiotisCharalampous
11 Jun 2018, 09:34
Dear Trader,
Thanks for posting in our forum. This is currently not possible in cAlgo. A workaround is to get the Color as a string parameter and use the following function to convert the string to a Color
Let me know if this helps,
Best Regards,
Panagiotis
@PanagiotisCharalampous