Simple indicator for cAlgo

1
Hi please can someone fix this code? I need a segment drawn above and below the minimum and maximum of the candle preceding the one in formation increased by n pips.

Thanks to anyone who can help me.

using cAlgo.API;

Code: Select all

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class HighLowOffsetIndicator : Indicator
    {
        [Parameter("Offset (pips)", DefaultValue = 10, MinValue = 1)]
        public int Offset { get; set; }

        protected override void Initialize()
        {
            // Set up the indicator
        }

        public override void Calculate(int index)
        {
            var high = MarketSeries.High[index - 1] + Symbol.PipSize * Offset;
            var low = MarketSeries.Low[index - 1] - Symbol.PipSize * Offset;

            ChartObjects.DrawLine("HighOffsetLine", index.ToString(), index - 1, high, index, high, Colors.Blue);
            ChartObjects.DrawLine("LowOffsetLine", index.ToString(), index - 1, low, index, low, Colors.Red);
        }
    }
}


Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests