Topics
14 May 2015, 00:06
 3353
 2
Replies

Iman
29 Jun 2015, 14:57

Thank you and good luck !


@Iman

Iman
27 Jun 2015, 10:16 ( Updated at: 21 Dec 2023, 09:20 )

I think that cAlgo has a Big Bug and it need to debug very soon!

This problem is in the “ChartObjects.DrawText” code.

When I use it in the “For” loop, before “If” command (Line 76), it give different output than use it inside “if” (Line 83) command in this code!

Please see carefully again following code “

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
 
 
namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        private string Space = "";
 
        private MarketSeries Market_Series;
        private int CC;
        [Output("Line1", Color = Colors.Blue)]
        public IndicatorDataSeries Line1 { get; set; }
        [Output("Line2", Color = Colors.Violet)]
        public IndicatorDataSeries Line2 { get; set; }
 
        protected override void Initialize()
        {
            Market_Series = MarketData.GetSeries(TimeFrame);
            CC = Market_Series.Close.Count;
        }
 
        public override void Calculate(int index)
        {
            double HH1 = Market_Series.High[index];
            double LL1 = Market_Series.Low[index];
 
            double HH2 = Market_Series.High[index];
            double LL2 = Market_Series.Low[index];
 
 
            for (int j = 0; j < 26; j++)
            {
                if (HH2 < Market_Series.High[index - j])
                {
                    HH2 = Market_Series.High[index - j];
                }
                if (LL2 > Market_Series.Low[index - j])
                {
                    LL2 = Market_Series.Low[index - j];
                }
            }
 
            Line2[index + 13] = (HH2 + LL2) / 2.0;
 
 
 
 
            if (index > CC - 200)
            {
                for (int j = 9; j <= 26; j++)
                {
                    for (int i = 0; i < j; i++)
                    {
                        if (HH1 < Market_Series.High[index - i])
                        {
                            HH1 = Market_Series.High[index - i];
                        }
                        if (LL1 > Market_Series.Low[index - i])
                        {
                            LL1 = Market_Series.Low[index - i];
                        }
                        Line1[index + 26 - j] = (HH1 + LL1) / 2.0;
                    }
                }
            }
 
 
            for (int i = CC; i < CC + 13; i++)
            {
                ChartObjects.DrawText("StaticPositionText" + i, Space + "Line1[" + i + "]= " + Line1[i] + " # Line2[" + i + "]= " + Line2[i], StaticPosition.TopRight, Colors.HotPink);
                Space += "\n";
 
                if ((Line1[i] >= Line2[i] && Line1[i - 1] < Line2[i - 1]))
                {
 
                    ChartObjects.DrawVerticalLine("CrossVerticalLine" + i, i, Colors.HotPink, 1, LineStyle.Lines);
                    ChartObjects.DrawText("CrossVerticalText" + i, "Line1[" + i + "]= " + Line1[i] + " # Line2[" + i + "]= " + Line2[i], i, LL1, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.HotPink);
                }
            }
            Space = "";
        }
    }
}

As you can see, I have two series it output on the below Chart:

 

When I use “ChartObjects.DrawText” code inside “FOR” and outside “IF” (Line 76), for example: Line1for candle No.320 has value =1.222765(as shown top right corner) that’s right! But the same value is 1.317535 on the chart! That it is for Line2 [320]!

Whatever my code is correct’ but cAlgo calculates and shows two different value for the same command on chart.

I no need to any programmer that write code for me. YOU MUST DEBUG cAlgo! Because I think that is bug in Platform cAlgo.

PLEASE CONSIDER MATTER TO DEVELOPER CALGO TEAM IN SPOTWARE CO. AND SEND RESULT HERE.

Thanks a lot.

Good Luck!

 


@Iman