Topics
23 Jan 2016, 22:47
 7184
 11
Replies

atomrus1993@gmail.com
24 Jan 2016, 14:12

RE:

tmc. said:

I don't know what else could be causing problem. Your cAlgo is working for me without any issue. Make sure you are inserting valid colors name. Try to change to "Yellow" for example.

Okay, thank you man, I will not touch you and distract, may eventually find a solution.


@atomrus1993@gmail.com

atomrus1993@gmail.com
24 Jan 2016, 14:11 ( Updated at: 21 Dec 2023, 09:20 )

RE:

tmc. said:

I don't know what else could be causing problem. Your cAlgo is working for me without any issue. Make sure you are inserting valid colors name. Try to change to "Yellow" for example.

 

Now he works as a line, that is, in words I am writing color, and whether it is possible to do when selecting I could choose the color?)) As there


@atomrus1993@gmail.com

atomrus1993@gmail.com
24 Jan 2016, 13:48

RE:

tmc. said:

Change line 12 to this:

private Colors spread_c;

 

(( sry man....

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{

    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class DrawSpread : Indicator
    {
        private Colors spread_c;
        [Parameter("Spread Color", DefaultValue = "White")]
        public string Spread_Color { get; set; }
        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
            Enum.TryParse<Colors>(Spread_Color, out spread_c);
        }

        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("Label", "Spread:", StaticPosition.TopLeft, spread_c);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.TopLeft, spread_c);
        }
    }
}

No change is not present, I still think it is necessary to change the line 14 the variable type. You see, I want to make here is that when you open the property would be an indicator, I can choose the color, for example, in MA, have any ideas? For the second day I fight ...


@atomrus1993@gmail.com

atomrus1993@gmail.com
24 Jan 2016, 13:31

RE:

tmc. said:

Hi, try this. ;)

Enum.TryParse(Spread_Color, out spread_c);

 

thx man!

I try this.

Which type of variable should be? I tried IndicatorDataSeries but it was impossible to compile. Could you help me?

        [Parameter("Spread Color", DefaultValue = "White")]
        public string Spread_Color { get; set; }

 


@atomrus1993@gmail.com