How to Explain the Situation?? the Calgo'builder is wrong???

Created at 19 Apr 2018, 21:12
Bits's avatar

Bits

Joined 14.03.2018

How to Explain the Situation?? the Calgo'builder is wrong???
19 Apr 2018, 21:12


Who can Explain the calgo's build error???  Use below code, Whether​ it should not be  draw a indicator line And drawtext "NAN" in the high of every Bar or draw a indicator line in the price 107.39 and drawText 107.39 in the high of every Bar,  but the result is Disappointing​...
​the drawText(result) is107.39, but the indicatot not draw a indicator line
Is it my fault?​????



namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CS : Indicator
    {
        [Output("main", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }
        protected override void Initialize()
        {
        }
        public override void Calculate(int index)
        {
            if (index == 0)
            {
                Result[0] = 107.39;
            }
            Result[index] = 107.39;
            Result[index - 1] = double.NaN;

            ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, MarketSeries.High[index] + 0.01);

        }
    }
}


@Bits
Replies

Bits
19 Apr 2018, 21:22 ( Updated at: 21 Dec 2023, 09:20 )

RE:

    Who can Explain the calgo's build error??? Use below code, Whether​ it should not be  draw a indicator line And drawtext "NAN" in the high of every Bar or draw a indicator line in the price 107.39 and drawText 107.39 in the high of every Bar,  but the result is Disappointing​...
the drawText(result) is107.39, but the indicatot not draw a indicator line

    Is it my fault?​????

The Result property show two diffirent  value??????

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CS : Indicator
    {
        [Output("main", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }
        protected override void Initialize()
        {
        }
        public override void Calculate(int index)
        {
            if (index == 0)
            {
                Result[0] = 107.39;
            }
            Result[index] = 107.39;
            Result[index - 1] = double.NaN;

            ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, MarketSeries.High[index] + 0.01);

        }
    }
}

 


@Bits

Bits
20 Apr 2018, 04:27

RE: RE:

yearn2012 said:

I have find find it is my wrong,now want to know while indicator[index] has draw the value,  how to redraw it if needed.

 

 


@Bits