Weekly High&Low

Created at 09 Dec 2013, 16:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ST

st0424

Joined 23.09.2013

Weekly High&Low
09 Dec 2013, 16:01


English is not good at me.
It may be hard to come, but, please tell me someone.

The code below is the indicator to draw line on the highs and lows of the current week.

using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AutoRescale = false)]
    public class WeeklyHighLow : Indicator
    {
        public override void Calculate(int index)
        {
            double high = MarketSeries.High.LastValue;
            double low = MarketSeries.Low.LastValue;

            for (int i = MarketSeries.Close.Count - 2; i > 0; i--)
            {
                if (MarketSeries.OpenTime[i].DayOfWeek < DayOfWeek.Monday)
                    break;

                high = Math.Max(high, MarketSeries.High[i]);
                low = Math.Min(low, MarketSeries.Low[i]);
            }

            ChartObjects.DrawHorizontalLine("high", high, Colors.Red);
            ChartObjects.DrawHorizontalLine("low", low, Colors.Blue);

        }
    }
}

Display is to be in this code, separate the time deviated.
I want to match (UTC +2) start 0:00.
This code does not draw a line only the highs and lows from 3:00 or 2:00.

And did you or try to add the Timezone, but it did not go well.

Whether, thank you.

 


@st0424
Replies

st0424
09 Dec 2013, 16:27

I have solved the problem.


@st0424