Category Trend  Published on 20/06/2019

MTF Open

Description

Follow my cTrader Telegram group at https://t.me/cTraderCommunity; it's a new community but it will grow fast, plus everyone can talk about cTrader indicators and algorithm without restrictions, though it is not allowed to spam commercial indicators to sell them.

I made this because a user from my group requested this indicator, which he already possessed, with a slight mod.

It shows the open prices of every major TF on chart, following Crucial Point's philosophy that 95% of the time, price is gonna be above or below the open... so follow the price!

A version with telegram notification for when all tf align is probably incoming, stay tuned.


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 MTFOpen : Indicator
    {
        [Output("Hour", Color = Colors.Indigo)]
        public IndicatorDataSeries _hour { get; set; }
        [Output("Hour 4", Color = Colors.RoyalBlue)]
        public IndicatorDataSeries _hour4 { get; set; }
        [Output("Daily", Color = Colors.ForestGreen)]
        public IndicatorDataSeries _day { get; set; }
        [Output("Weekly", Color = Colors.YellowGreen)]
        public IndicatorDataSeries _week { get; set; }
        [Output("Monthly", Color = Colors.Orange)]
        public IndicatorDataSeries _month { get; set; }

        public MarketSeries hour, hour4, daily, week, month;

        protected override void Initialize()
        {
            hour = MarketData.GetSeries(TimeFrame.Hour);
            hour4 = MarketData.GetSeries(TimeFrame.Hour4);
            daily = MarketData.GetSeries(TimeFrame.Daily);
            week = MarketData.GetSeries(TimeFrame.Weekly);
            month = MarketData.GetSeries(TimeFrame.Monthly);
        }

        public override void Calculate(int index)
        {
            int i_hour = hour.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
            int i_hour4 = hour4.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
            int i_daily = daily.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
            int i_week = week.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
            int i_month = month.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);

            _hour[index] = hour.Open[i_hour];
            _hour4[index] = hour4.Open[i_hour4];
            _day[index] = daily.Open[i_daily];
            _week[index] = week.Open[i_week];
            _month[index] = month.Open[i_month];

            Chart.DrawStaticText("Hour Open", "Hour Open: " + _hour[index] + "\nPips: " + Math.Round((MarketSeries.Close[index] - _hour[index]) / Symbol.PipSize, 1), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Indigo);
            Chart.DrawStaticText("4 Hours Open", "\n\n4 Hours Open: " + _hour4[index] + "\nPips: " + Math.Round((MarketSeries.Close[index] - _hour4[index]) / Symbol.PipSize, 1), VerticalAlignment.Top, HorizontalAlignment.Left, Color.RoyalBlue);
            Chart.DrawStaticText("Daily Open", "\n\n\n\nDaily Open: " + _day[index] + "\nPips: " + Math.Round((MarketSeries.Close[index] - _day[index]) / Symbol.PipSize, 1), VerticalAlignment.Top, HorizontalAlignment.Left, Color.ForestGreen);
            Chart.DrawStaticText("Week Open", "\n\n\n\n\n\nWeek Open: " + _week[index] + "\nPips: " + Math.Round((MarketSeries.Close[index] - _week[index]) / Symbol.PipSize, 1), VerticalAlignment.Top, HorizontalAlignment.Left, Color.YellowGreen);
            Chart.DrawStaticText("Month Open", "\n\n\n\n\n\n\n\nMonth Open: " + _month[index] + "\nPips: " + Math.Round((MarketSeries.Close[index] - _month[index]) / Symbol.PipSize, 1), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Orange);
        }
    }
}


CY
cysecsbin.01

Joined on 10.11.2018 Blocked

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: MTF Open.algo
  • Rating: 0
  • Installs: 1836
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.