reversal bar free

by d.deel in category Other at 06/01/2021
Description

Indicator has been /* UPGRADED/*, with the option to determine your own period for reversal signals, and a build in zigzag with customable periods 

just a simple indicator to help those who have a hard time entering positions, not necessarily a trend base indicator, it' s recommended to use other indicators as well(add it to your stra)

in this caption other indicators are being used as well(indicators with their rightful owner), also not necessarily recommended 

 

 

 

purple for sell & blue for buy 

 

// if you have any feedbacks leave them in the comment section   

also before use, it is better to set your candle color and outline on transparent 

 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐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 Re_reversalBars : Indicator
    {
        [Parameter("Thickness", Group = "thickness sett", DefaultValue = 3)]
        public int thi { get; set; }
        [Parameter("Bullish", Group = "Colors sett", DefaultValue = "Blue")]
        public string colo1 { get; set; }
        [Parameter("Bearish", Group = "Colors sett", DefaultValue = "Purple")]
        public string colo2 { get; set; }
        [Parameter("others", Group = "Colors sett", DefaultValue = "Black")]
        public string colo3 { get; set; }
        [Parameter("others", Group = "Colors sett", DefaultValue = "Gray")]
        public string colo4 { get; set; }
        [Parameter("Sycle Periode", DefaultValue = 3, MinValue = 0)]
        public int P_periode { get; set; }
        [Parameter("Zigzag Periode", DefaultValue = 7, MinValue = 0)]
        public int Z_zigPeriode { get; set; }


        private int comfirmer_2;
        private DateTime starts;


        protected override void Initialize()
        {
            comfirmer_2 = 1;
        }

        private int Z_zigInitialize()
        {
            int Z_Result = 0;
            double zigHigh = Functions.Maximum(Bars.HighPrices, Z_zigPeriode);
            if (Bars.HighPrices.LastValue >= zigHigh)
                Z_Result = 1;
            else
            {
                double zigLow = Functions.Minimum(Bars.LowPrices, Z_zigPeriode);
                if (Bars.LowPrices.LastValue <= zigLow)
                    Z_Result = -1;
            }
            return Z_Result;
        }



        private DateTime cycle;
        public override void Calculate(int index)
        {
            starts = Bars.OpenTimes[index - 1];
            int i = 1;
            while (i < P_periode)
            {
                if (Bars.OpenTimes[index - i] == cycle)
                    return;
                else
                {
                    Chart.DrawTrendLine("other2" + starts, starts, Bars.OpenPrices[index - 1], starts, Bars.ClosePrices[index - 1], color: colo4, thickness: thi);
                }
                i++;
            }

            int zig_ = Z_zigInitialize();
            switch (comfirmer_2)
            {
                case -1:
                    bool T_down = Bars.ClosePrices[index - 1] < Bars.LowPrices[index - 2] && Bars.ClosePrices[index - 1] < Bars.LowPrices[index - 3];
                    if (T_down && zig_ == -1)
                    {
                        cycle = Bars.OpenTimes[index - 1];
                        comfirmer_2 = 1;
                        Chart.DrawTrendLine("low_tren" + starts, starts, Bars.OpenPrices[index - 1], starts, Bars.ClosePrices[index - 1], color: colo2, thickness: thi);
                    }
                    else
                    {
                        if (Bars.HighPrices[index - 1] >= Bars.ClosePrices[index - 2] || Bars.LowPrices[index - 1] <= Bars.ClosePrices[index - 2])
                            Chart.DrawTrendLine("other" + starts, starts, Bars.OpenPrices[index - 1], starts, Bars.ClosePrices[index - 1], color: colo3, thickness: thi);
                    }
                    break;
                case 1:
                    bool T_up = Bars.ClosePrices[index - 1] > Bars.HighPrices[index - 2] && Bars.ClosePrices[index - 1] > Bars.HighPrices[index - 3];
                    if (T_up && zig_ == 1)
                    {
                        cycle = Bars.OpenTimes[index - 1];
                        comfirmer_2 = -1;
                        Chart.DrawTrendLine("high_tren" + starts, starts, Bars.OpenPrices[index - 1], starts, Bars.ClosePrices[index - 1], color: colo1, thickness: thi);
                    }
                    else
                    {
                        if (Bars.HighPrices[index - 1] >= Bars.ClosePrices[index - 2] || Bars.LowPrices[index - 1] <= Bars.ClosePrices[index - 2])
                            Chart.DrawTrendLine("other_2" + starts, starts, Bars.OpenPrices[index - 1], starts, Bars.ClosePrices[index - 1], color: colo3, thickness: thi);
                    }
                    break;
            }
        }
    }
}
Comments
0