Category Other  Published on 15/04/2020

PVSRA Round Numbers

Description

Round Numbers indicator of PVSRA


using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class PVSRARoundNumbers : Indicator
    {
        [Parameter(DefaultValue = 100)]
        public int StepPips { get; set; }

        protected override void Initialize()
        {
            double max = Bars.HighPrices.Maximum(Bars.HighPrices.Count);
            double min = Bars.LowPrices.Minimum(Bars.LowPrices.Count);

            double step = Symbol.PipSize * StepPips;
            double start = Math.Floor(min / step) * step;
            double half = step / 2;
            double quarter = step / 4;

            Color cWhole = Color.FromHex("#30FFFFFF");
            Color cHalf = Color.FromHex("#5000843B");
            Color cQuarter = Color.FromHex("#507030A0");

            for (double level = start; level <= max + step; level += step)
            {
                Print("{0} {1} {2}", level, level + half, level + quarter);

                Chart.DrawHorizontalLine("WholeLine" + level, level, cWhole);
                Chart.DrawHorizontalLine("HalfLine" + level, level + half, cHalf);
                Chart.DrawHorizontalLine("QuarterUpLine" + level, level + quarter, cQuarter);
                Chart.DrawHorizontalLine("QuarterDownLine" + level, level - quarter, cQuarter);
            }
        }

        public override void Calculate(int index)
        {
        }
    }
}


reyx's avatar
reyx

Joined on 16.02.2019

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: PVSRA Round Numbers.algo
  • Rating: 5
  • Installs: 2128
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.